imagen.imagen Package


imagen Package

Inheritance diagram of imagen.__init__

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.

class imagen.__init__.Angle(**params)[source]

Bases: imagen.patterngenerator.Composite

Angle composed of two line segments.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number angle (allow_None=False, bounds=(0.0, None), constant=False, default=0.785398163397, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.63, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Angle between the two line segments.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness of the rectangle.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off around the rectangles.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.01, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Overall diameter of the pattern, if angle=pi.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d4c8>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d368>
inspect_value = <functools.partial object at 0x2adfbaf6d520>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d5d0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d3c0>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.OrientationContrast(**params)[source]

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.

param Number orientationsurround (allow_None=False, bounds=(-6.283185307179586, 6.283185307179586), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Orientation of the surround grating, either absolute or relative to the central grating.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number frequency (allow_None=False, bounds=(0.0, None), constant=False, default=2.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Frequency of the sine grating.
param Number orientationcenter (allow_None=False, bounds=(0.0, 6.283185307179586), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Orientation of the center grating.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the ring.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number scalesurround (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scale of the surround grating.
param Number scalecenter (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scale of the center grating.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number offsetsurround (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Offset of the surround grating.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.3, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number sizecenter (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the center grating.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number sizesurround (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the surround grating.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Number phase (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.51, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Phase of the sine grating.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the overall width.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number offsetcenter (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Offset of the center grating.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Boolean surround_orientation_relative (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Determines whether the surround grating is relative to the central grating.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d0a8>
function(p)

Return a sine grating pattern (two-dimensional sine wave).

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d1b0>
inspect_value = <functools.partial object at 0x2adfbaf6d578>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d628>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d260>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Spiral(**params)[source]

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.02, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the spiral.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number turning (allow_None=False, bounds=(0.01, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density of turnings; turning*angle gives the actual radius.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the spiral.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d158>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d5d0>
inspect_value = <functools.partial object at 0x2adfbaf6d310>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d4c8>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d470>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.SigmoidedDoLG(**params)[source]

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.

param Number positive_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the positive LogGaussian pattern.
param Number positive_scale (allow_None=False, bounds=(0.0, None), constant=False, default=1.5, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative scale for the positive LogGaussian pattern.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number sigmoid_position (allow_None=False, bounds=(None, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X position of the transition between the two regions.
param Number negative_scale (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative scale for the negative LogGaussian pattern.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number negative_x_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.8, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the x axis for the negative LogGaussian pattern.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number negative_y_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.35, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the y axis for the negative LogGaussian pattern.
param Number positive_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the positive LogGaussian pattern.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number negative_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=0.3, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the negative LogGaussian pattern.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number positive_y_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.35, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the y axis for the positive LogGaussian pattern.
param Number negative_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.8, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the negative LogGaussian pattern.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Number sigmoid_slope (allow_None=False, bounds=(None, None), constant=False, default=50.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Parameter controlling the smoothness of the transition between the two regions; high values give a sharp transition.
param Number positive_x_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.8, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the x axis for the positive LogGaussian pattern.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d628>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d470>
inspect_value = <functools.partial object at 0x2adfbaf6d520>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d368>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d0a8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Spectrogram(**params)[source]

Bases: imagen.__init__.PowerSpectrum

Extends PowerSpectrum to provide a temporal buffer, yielding a 2D representation of a fixed-width spectrogram.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer min_latency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest latency (in milliseconds) for which to return amplitudes.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Integer max_latency (allow_None=False, bounds=(0, None), constant=False, default=500, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest latency (in milliseconds) for which to return amplitudes.
param TimeSeriesParam signal (allow_None=False, constant=False, default=<TimeSeries TimeSeries01037>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object on which to perfom the Fourier Transform.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d158>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d208>
inspect_value = <functools.partial object at 0x2adfbaf6d4c8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d260>
set_param = <functools.partial object at 0x2adfbaf6d310>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.SpiralGrating(**params)[source]

Bases: imagen.patterngenerator.Composite

Grating pattern made from overlaid spirals.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the spiral.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the spiral.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Integer parts (allow_None=False, bounds=(1, None), constant=False, default=2, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of parts in the grating.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
param Number turning (allow_None=False, bounds=(0.01, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density of turnings; turning*angle gives the actual radius.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d1b0>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d2b8>
inspect_value = <functools.partial object at 0x2adfbaf6d520>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d628>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d470>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.ArcCentered(**params)[source]

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the overall width.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number arc_length (allow_None=False, bounds=(0.0, None), constant=False, default=3.14159265359, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Length of the arc, in radians, starting from orientation 0.0.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d310>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d260>
inspect_value = <functools.partial object at 0x2adfbaf6d520>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d470>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d208>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.PatternGenerator(**params)

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d520>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d0a8>
inspect_value = <functools.partial object at 0x2adfbaf6d4c8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d628>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d208>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Rectangle(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D rectangle pattern, with Gaussian smoothing around the edges.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the width of the rectangle.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off outside the rectangle.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Height of the rectangle.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d680>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d310>
inspect_value = <functools.partial object at 0x2adfbaf6d260>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d2b8>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d6d8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Sweeper(**params)[source]

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.

param Number step_offset (allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The number of steps to offset the sweeper by.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number speed (allow_None=False, bounds=(0.0, None), constant=False, default=0.0833333333333, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The speed with which the pattern should move, in sheet coordinates per time_fn unit.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param ClassSelector generator (allow_None=False, constant=False, default=<Gaussian Gaussian01036>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.97, readonly=False)
Pattern to sweep.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number relative_motion_orientation (allow_None=False, bounds=(0, 6.283185307179586), constant=False, default=1.57079632679, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The direction in which the pattern should be moved, relative to the orientation of the supplied generator
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param HookList channel_transforms (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Optional functions to apply post processing to the set of channels.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Callable time_fn (allow_None=False, constant=False, default=<Time Time00001>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to generate the time used as a base for translation.
param Number reset_period (allow_None=False, bounds=(0, None), constant=False, default=4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Period between generating each new translation episode.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Number time_offset (allow_None=False, bounds=None, constant=False, default=0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The time offset from which frames are generated given the supplied pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d4c8>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d628>
inspect_value = <functools.partial object at 0x2adfbaf6d470>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d1b0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d0a8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.DifferenceOfGaussians(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Two-dimensional difference of Gaussians pattern.

param Number positive_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the positive region of the pattern.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number positive_x (allow_None=False, bounds=(None, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X position for the central peak of the positive region.
param Number positive_y (allow_None=False, bounds=(None, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y position for the central peak of the positive region.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number negative_x (allow_None=False, bounds=(None, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=7, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X position for the central peak of the negative region.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number negative_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the negative region of the pattern.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number negative_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.3, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the negative region of the pattern.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number negative_y (allow_None=False, bounds=(None, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=8, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y position for the central peak of the negative region.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Number positive_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the positive region of the pattern.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d310>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d2b8>
inspect_value = <functools.partial object at 0x2adfbaf6d5d0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6daa0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6dc00>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Composite(**params)

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d260>
function(p)

Constructs combined pattern out of the individual ones.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d100>
inspect_value = <functools.partial object at 0x2adfbaf6d5d0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d310>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d578>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Asterisk(**params)[source]

Bases: imagen.patterngenerator.Composite

Asterisk-like object composed of radial rectangular lines. Also makes crosses and tripods.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Integer parts (allow_None=False, bounds=(1, None), constant=False, default=3, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of parts in the asterisk.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness of the rectangle.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off around the rectangles.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.01, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Overall diameter of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d680>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d3c0>
inspect_value = <functools.partial object at 0x2adfbaf6d890>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d520>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d578>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Selector(**params)[source]

Bases: imagen.patterngenerator.CompositeBase

PatternGenerator that selects from a list of other PatternGenerators.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number index (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=<UniformRandom UniformRandom01035>, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Index into the list of pattern generators, on a scale from 0 (start of the list) to 1.0 (end of the list). Typically a random value or other number generator, to allow a different item to be selected each time.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)[source]

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() ).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d5d0>
function(p)[source]

Selects and returns one of the patterns in the list.

get_current_generator()[source]

Return the current generator (as specified by self.index).

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d890>
inspect_value = <functools.partial object at 0x2adfbaf6d260>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()[source]

Get the number of channels in the input generators.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d578>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d838>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.ChannelGenerator(**params)

Bases: imagen.patterngenerator.PatternGenerator

Abstract base class for patterns supporting multiple channels natively.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param HookList channel_transforms (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Optional functions to apply post processing to the set of channels.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d520>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d3c0>
inspect_value = <functools.partial object at 0x2adfbaf6d2b8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d838>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d890>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.ComposeChannels(**params)

Bases: imagen.patterngenerator.ChannelGenerator

Create a multi-channel PatternGenerator from a list of PatternGenerators, with the specified channel_transforms applied.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param HookList channel_transforms (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Optional functions to apply post processing to the set of channels.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01031’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of patterns to use for each channel. Generators which already have more than one channel will only contribute to a single channel of ComposeChannels.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d158>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d730>
inspect_value = <functools.partial object at 0x2adfbaf6d2b8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6dcb0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d680>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.ExponentialDecay(**params)[source]

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))
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=3.22580645161, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of the width to the height.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.155, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Overall scaling of the x and y dimensions.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d208>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d838>
inspect_value = <functools.partial object at 0x2adfbaf6d890>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d520>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d158>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.HyperbolicGrating(**params)[source]

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

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness of the hyperbolas.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the hyperbolas.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size as distance of inner hyperbola vertices from the centre.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6dcb0>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d730>
inspect_value = <functools.partial object at 0x2adfbaf6d578>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d260>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d208>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Line(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D line pattern generator.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Boolean enforce_minimal_thickness (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False)
If True, ensure that the line is at least one pixel in width even for small thicknesses where the line could otherwise fall in between pixel centers and thus disappear at some orientations.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.006, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (width) of the solid central part of the line.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1.0, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d890>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d3c0>
inspect_value = <functools.partial object at 0x2adfbaf6d100>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d838>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d260>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.LogGaussian(**params)[source]

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.

param Number x_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.8, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the x axis.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number y_shape (allow_None=False, bounds=(0.0, None), constant=False, default=0.35, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of the tail along the y axis.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of the pattern’s width to height.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d578>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d788>
inspect_value = <functools.partial object at 0x2adfbaf6d208>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d838>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d260>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.SquareGrating(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D squarewave (symmetric or asymmetric) grating pattern generator.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number phase (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.51, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Phase of the square grating.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number frequency (allow_None=False, bounds=(0.0, None), constant=False, default=2.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Frequency of the square grating.
param Number duty_cycle (allow_None=False, bounds=(0.0, 1.0), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.51, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The duty cycle is the ratio between the pulse duration (width of the bright bar) and the period (1/frequency). The pulse is defined as the time during which the square wave signal is 1 (high).
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d890>
function(p)[source]

Return a square-wave grating (alternating black and white bars).

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d208>
inspect_value = <functools.partial object at 0x2adfbaf6d158>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d5d0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d100>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Gabor(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D Gabor pattern generator.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of pattern width to height. The width of the Gaussian component is size*aspect_ratio (see Gaussian).
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number phase (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.51, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Phase of the sine grating component.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number frequency (allow_None=False, bounds=(0.0, None), constant=False, default=2.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Frequency of the sine grating component.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.25, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the height of the Gaussian component (see Gaussian).
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d730>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d260>
inspect_value = <functools.partial object at 0x2adfbaf6d368>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d788>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d3c0>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.HalfPlane(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Constant pattern on in half of the plane, and off in the rest, with optional Gaussian smoothing.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.02, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d208>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d2b8>
inspect_value = <functools.partial object at 0x2adfbaf6d100>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d520>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d158>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.CompositeBase(**params)

Bases: imagen.patterngenerator.PatternGenerator

PatternGenerator that combines or selects from a list of other PatternGenerators.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d730>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d838>
inspect_value = <functools.partial object at 0x2adfbaf6d368>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d680>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d578>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Curve(**params)[source]

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.

param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the ring.
param Number arc_length (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1.0, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Length of the arc, in radians, starting from orientation 0.0.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param ObjectSelector size_type (allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=constant_length, instantiate=False, objects=[‘constant_length’, ‘constant_width’], pickle_default_value=True, precedence=0.61, readonly=False)
For a given size, whether to draw a curve with that total length, or with that width, keeping it constant as curvature is varied.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number curvature (allow_None=False, bounds=(-0.5, 0.5), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of height to width of the arc, with positive value giving a concave shape and negative value giving convex.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1.0, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the overall width.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d100>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d3c0>
inspect_value = <functools.partial object at 0x2adfbaf6d310>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d158>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d998>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.RadialGrating(**params)[source]

Bases: imagen.patterngenerator.Composite

Grating pattern made from alternating smooth circular segments (pie-shapes).

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Integer parts (allow_None=False, bounds=(1, None), constant=False, default=4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of parts in the grating.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off outside the sector, scaled by parts.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d838>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d680>
inspect_value = <functools.partial object at 0x2adfbaf6d310>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d2b8>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d368>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.ConcentricRings(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Concentric rings with linearly increasing radius. Gaussian fall-off at the edges.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.04, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the rings.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.01, None), constant=False, default=0.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Radius difference of neighbouring rings.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d5d0>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d310>
inspect_value = <functools.partial object at 0x2adfbaf6d998>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d788>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d3c0>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.RawRectangle(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D rectangle pattern generator with no smoothing, for use when drawing patterns pixel by pixel.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the width of the rectangle.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Height of the rectangle.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d5d0>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d2b8>
inspect_value = <functools.partial object at 0x2adfbaf6d940>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d520>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d838>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Wedge(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

A sector of a circle with Gaussian fall-off, with size determining the arc length.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off outside the sector.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.785398163397, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Angular length of the sector, in radians.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d100>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d158>
inspect_value = <functools.partial object at 0x2adfbaf6d7e0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d998>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d368>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Constant(**params)

Bases: imagen.patterngenerator.PatternGenerator

Constant pattern generator, i.e., a solid, uniform field of the same value.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d2b8>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d3c0>
inspect_value = <functools.partial object at 0x2adfbaf6d838>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d578>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d260>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Sigmoid(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Two-dimensional sigmoid pattern, dividing the plane into positive and negative halves with a smoothly sloping transition between them.

param Number slope (allow_None=False, bounds=(None, None), constant=False, default=10.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Parameter controlling the smoothness of the transition between the two regions; high values give a sharp transition.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d158>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d100>
inspect_value = <functools.partial object at 0x2adfbaf6d7e0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d788>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d520>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.SigmoidedDoG(**params)[source]

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.

param Number positive_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the positive Gaussian pattern.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number sigmoid_position (allow_None=False, bounds=(None, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X position of the transition between the two regions.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number positive_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=2.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the positive Gaussian pattern.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number negative_aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height for the negative Gaussian pattern.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number negative_size (allow_None=False, bounds=(0.0, None), constant=False, default=0.25, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Size of the negative Gaussian pattern.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Number sigmoid_slope (allow_None=False, bounds=(None, None), constant=False, default=10.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Parameter controlling the smoothness of the transition between the two regions; high values give a sharp transition.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d940>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d578>
inspect_value = <functools.partial object at 0x2adfbaf6d680>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d520>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d2b8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Gaussian(**params)[source]

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)
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=3.22580645161, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of the width to the height. Specifically, xsigma=ysigma*aspect_ratio (see size).
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.155, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Overall size of the Gaussian, defined by: exp(-x^2/(2*xsigma^2) - y^2/(2*ysigma^2) where ysigma=size/2 and xsigma=size/2*aspect_ratio.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d260>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d788>
inspect_value = <functools.partial object at 0x2adfbaf6d158>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d7e0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d100>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.SineGrating(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D sine grating pattern generator.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number phase (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.51, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Phase of the sine grating.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number frequency (allow_None=False, bounds=(0.0, None), constant=False, default=2.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.5, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Frequency of the sine grating.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d8e8>
function(p)[source]

Return a sine grating pattern (two-dimensional sine wave).

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d520>
inspect_value = <functools.partial object at 0x2adfbaf6d3c0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d578>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d368>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Arc(**params)[source]

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the overall width.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number arc_length (allow_None=False, bounds=(0.0, None), constant=False, default=3.14159265359, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=0.62, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Length of the arc, in radians, starting from orientation 0.0.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d260>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d310>
inspect_value = <functools.partial object at 0x2adfbaf6d7e0>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d368>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d3c0>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.PowerSpectrum(**params)[source]

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param TimeSeriesParam signal (allow_None=False, constant=False, default=<TimeSeries TimeSeries01037>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object on which to perfom the Fourier Transform.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d7e0>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d158>
inspect_value = <functools.partial object at 0x2adfbaf6d8e8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d680>
set_param = <functools.partial object at 0x2adfbaf6d838>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Ring(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

2D ring pattern generator.

See the Disk class for a note about the Gaussian fall-off.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the overall width.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number thickness (allow_None=False, bounds=(0.0, None), constant=False, default=0.015, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.6, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Thickness (line width) of the ring.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off inside and outside the ring.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d520>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d100>
inspect_value = <functools.partial object at 0x2adfbaf6d940>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d310>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d578>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.__init__.Disk(**params)[source]

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the width of the disk.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number smoothing (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.61, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Width of the Gaussian fall-off
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Top to bottom height of the disk
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbaf6d838>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbaf6d788>
inspect_value = <functools.partial object at 0x2adfbaf6d8e8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbaf6d158>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbaf6d100>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.


audio Module

Inheritance diagram of imagen.audio

Pattern generators for audio signals.

class imagen.audio.AudioFile(**params)[source]

Bases: imagen.TimeSeries

Requires an audio file in any format accepted by audiolab (wav, aiff, flac).

param Array time_series (allow_None=True, constant=False, default=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1], instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
An array of numbers that form a series.
param Boolean repeat (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether the signal loops or terminates once it reaches its end.
param Parameter precision (allow_None=False, constant=False, default=<type ‘numpy.float64’>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The float precision to use for loaded audio files.
param Filename filename (allow_None=False, constant=False, default=sounds/complex/daisy.wav, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, search_paths=[])
File path (can be relative to Param’s base path) to an audio file. The audio can be in any format accepted by audiolab, e.g. WAV, AIFF, or FLAC.
param Number sample_rate (allow_None=False, bounds=(0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The number of samples taken per second to form the series.
param Number seconds_per_iteration (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of seconds advanced along the time series on each iteration.
param Number interval_length (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of time in seconds to be returned on each iteration.
debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

extract_specific_interval(interval_start, interval_end)

Overload if special behaviour is required when a series ends.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f788>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f730>
inspect_value = <functools.partial object at 0x2adfbc49f838>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

precision

alias of float64

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49f7e0>
set_param = <functools.partial object at 0x2adfbc49f8e8>
state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

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.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.audio.AudioFolder(**params)[source]

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.

param Array time_series (allow_None=True, constant=False, default=[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1], instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
An array of numbers that form a series.
param Boolean repeat (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether the signal loops or terminates once it reaches its end.
param Number gap_between_sounds (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The gap in seconds to insert between consecutive soundfiles.
param Parameter precision (allow_None=False, constant=False, default=<type ‘numpy.float64’>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The float precision to use for loaded audio files.
param Filename filename (allow_None=True, constant=False, default=sounds/complex/daisy.wav, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, search_paths=[])
File path (can be relative to Param’s base path) to an audio file. The audio can be in any format accepted by audiolab, e.g. WAV, AIFF, or FLAC.
param Number sample_rate (allow_None=False, bounds=(0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The number of samples taken per second to form the series.
param Number seconds_per_iteration (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of seconds advanced along the time series on each iteration.
param Foldername folderpath (allow_None=False, constant=False, default=sounds/sine_waves/normalized, instantiate=False, pickle_default_value=True, precedence=None, readonly=False, search_paths=[])
Folder path (can be relative to Param’s base path) to a folder containing audio files. The audio can be in any format accepted by audiolab, i.e. WAV, AIFF, or FLAC.
param Number interval_length (allow_None=False, bounds=(0.0, None), constant=False, default=0.1, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The length of time in seconds to be returned on each iteration.
debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

extract_specific_interval(interval_start, interval_end)[source]

Overload if special behaviour is required when a series ends.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f730>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f470>
inspect_value = <functools.partial object at 0x2adfbc49f680>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

precision

alias of float64

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49f4c8>
set_param = <functools.partial object at 0x2adfbc49f3c0>
state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

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.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.audio.LogSpectrogram(**params)[source]

Bases: imagen.Spectrogram

Extends Spectrogram to provide a response over an octave scale.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer min_latency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest latency (in milliseconds) for which to return amplitudes.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Integer max_latency (allow_None=False, bounds=(0, None), constant=False, default=500, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest latency (in milliseconds) for which to return amplitudes.
param Integer log_base (allow_None=False, bounds=(0.0, None), constant=False, default=2, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The base of the logarithm used to generate logarithmic frequency spacing.
param TimeSeriesParam signal (allow_None=False, constant=False, default=<TimeSeries TimeSeries01034>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object on which to perfom the Fourier Transform.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f8e8>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f7e0>
inspect_value = <functools.partial object at 0x2adfbc49f6d8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49f418>
set_param = <functools.partial object at 0x2adfbc49f998>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.audio.LyonsCochlearModel(**params)[source]

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.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number stage_overlap_factor (allow_None=False, bounds=None, constant=False, default=4.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The degree of overlap between filters. Successive filter stages are overlapped by a fraction of their bandwidth. The number is arbitrary but smaller numbers lead to more computations. We currently overlap 4 stages within the bandpass region of any one filter.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number quality_factor (allow_None=False, bounds=None, constant=False, default=8.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Quality factor controls the bandwidth of each cochlear filter. The bandwidth of each cochlear filter is a function of its center frequency. At high frequencies the bandwidth is approximately equal to the center frequency divided by a quality constant (quality_factor). At lower frequncies the bandwidth approaches a constant given by: 1000/quality_factor.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param Parameter precision (allow_None=False, constant=False, default=<type ‘numpy.float64’>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The float precision to use when calculating ear stage filters.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Parameter signal (allow_None=True, constant=False, default=<TimeSeries TimeSeries01034>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object to be fed to the model. This can be any kind of signal, be it from audio files or live from a mic, as long as the values conform to a TimeSeries.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f3c0>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f470>
inspect_value = <functools.partial object at 0x2adfbc49f680>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

precision

alias of float64

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49f940>
set_param = <functools.partial object at 0x2adfbc49f6d8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.audio.LyonsCochleogram(**params)[source]

Bases: imagen.audio.LyonsCochlearModel

Employs Lyons Cochlear Model to return a Cochleoogram, i.e. the response over time along the cochlea.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number stage_overlap_factor (allow_None=False, bounds=None, constant=False, default=4.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The degree of overlap between filters. Successive filter stages are overlapped by a fraction of their bandwidth. The number is arbitrary but smaller numbers lead to more computations. We currently overlap 4 stages within the bandpass region of any one filter.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Number quality_factor (allow_None=False, bounds=None, constant=False, default=8.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Quality factor controls the bandwidth of each cochlear filter. The bandwidth of each cochlear filter is a function of its center frequency. At high frequencies the bandwidth is approximately equal to the center frequency divided by a quality constant (quality_factor). At lower frequncies the bandwidth approaches a constant given by: 1000/quality_factor.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param Parameter precision (allow_None=False, constant=False, default=<type ‘numpy.float64’>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The float precision to use when calculating ear stage filters.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Parameter signal (allow_None=True, constant=False, default=<TimeSeries TimeSeries01034>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object to be fed to the model. This can be any kind of signal, be it from audio files or live from a mic, as long as the values conform to a TimeSeries.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f998>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f890>
inspect_value = <functools.partial object at 0x2adfbc49fa48>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

precision

alias of float64

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49f730>
set_param = <functools.partial object at 0x2adfbc49f7e0>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.audio.ModulatedLogSpectrogram(**params)[source]

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.

param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Integer min_latency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest latency (in milliseconds) for which to return amplitudes.
param Integer max_frequency (allow_None=False, bounds=(0, None), constant=False, default=9999, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest frequency for which to return an amplitude.
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number scale (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The amount by which to scale amplitudes by. This is useful if we want to rescale to say a range [0:1]. Note: Constant scaling is preferable to dynamic scaling so as not to artificially ramp down loud sounds while ramping up hiss and other background interference.
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
param Integer min_frequency (allow_None=False, bounds=(0, None), constant=False, default=0, inclusive_bounds=(True, False), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Smallest frequency for which to return an amplitude.
param Parameter windowing_function (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
This function is multiplied with the current interval, i.e. the most recent portion of the waveform interval of a signal, before performing the Fourier transform. It thus shapes the interval, which is otherwise always rectangular. The function chosen here dictates the tradeoff between resolving comparable signal strengths with similar frequencies, and resolving disparate signal strengths with dissimilar frequencies. numpy provides a number of options, e.g. bartlett, blackman, hamming, hanning, kaiser; see http://docs.scipy.org/doc/numpy/reference/routines.window.html You may also supply your own.
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Number upper_freq_bound (allow_None=False, bounds=(0.0, None), constant=False, default=7000.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The upper bound of the frequency range to be modulated.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param Integer max_latency (allow_None=False, bounds=(0, None), constant=False, default=500, inclusive_bounds=(False, False), instantiate=False, pickle_default_value=True, precedence=2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Largest latency (in milliseconds) for which to return amplitudes.
param Integer log_base (allow_None=False, bounds=(0.0, None), constant=False, default=2, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The base of the logarithm used to generate logarithmic frequency spacing.
param TimeSeriesParam signal (allow_None=False, constant=False, default=<TimeSeries TimeSeries01034>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A TimeSeries object on which to perfom the Fourier Transform.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number lower_freq_bound (allow_None=False, bounds=(0.0, None), constant=False, default=1000.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The lower bound of the frequency range to be modulated.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Parameter modulation_function (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The function by which to modulate the signal between the specified frequency range. The default (hanning) multiplies a section of the signal by a hanning window.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc49f9f0>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc49f418>
inspect_value = <functools.partial object at 0x2adfbc49f8e8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

static modulation_function(M)

Return the Hanning window.

The Hanning window is a taper formed by using a weighted cosine.

M : int
Number of points in the output window. If zero or less, an empty array is returned.
out : ndarray, shape(M,)
The window, with the maximum value normalized to one (the value one appears only if M is odd).

bartlett, blackman, hamming, kaiser

The Hanning window is defined as

\[w(n) = 0.5 - 0.5cos\left(\frac{2\pi{n}}{M-1}\right) \qquad 0 \leq n \leq M-1\]

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()
num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc49faa0>
set_param = <functools.partial object at 0x2adfbc49fba8>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.


colorspaces Module

Inheritance diagram of imagen.colorspaces

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:

ColorSpace
Provides a convert(from, to, what) method to perform conversion between colorspaces, e.g. convert("rgb", "hsv", X), where X is assumed to be a numpy.dstack() object with three matching arrays.
FeatureColorConverter

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),

  • working color space (to which the images will be converted),

    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.

class imagen.colorspaces.ColorSpace(**params)[source]

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.

param Parameter dtype (allow_None=False, constant=False, default=<type ‘numpy.float32’>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Datatype to use for result.
param NumericTuple output_limits (allow_None=False, constant=False, default=(0.0, 1.0), instantiate=False, length=2, pickle_default_value=True, precedence=None, readonly=False)
Upper and lower bounds to enforce on output values.
param Dict transforms (allow_None=False, constant=False, default={‘D65’: {‘rgb_from_xyz’: array([[ 3.241 , -1.5374, -0.4986], [-0.9692, 1.876 , 0.0416], [ 0.0556, -0.204 , 1.057 ]]), ‘xyz_from_lms’: array([[ 1.87616336e+00, -1.37368291e+00, 3.40220544e-01], [ 6.37205799e-01, 3.92411765e-01, 5.61517442e-05], [ 0.00000000e+00, 0.00000000e+00, 1.60642570e+00]]), ‘xyz_from_rgb’: array([[ 0.41238088, 0.35757284, 0.1804523 ], [ 0.21261986, 0.71513879, 0.07214994], [ 0.0193435 , 0.11921217, 0.95050657]]), ‘lms_from_xyz’: array([[ 0.2435, 0.8524, -0.0516], [-0.3954, 1.1642, 0.0837], [ 0. , 0. , 0.6225]])}}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Structure containing the transformation matrices used by this Class. See transforms in this file.
param String whitepoint (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=D65, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Name of whitepoint in lookup table.
param ObjectSelector output_clip (allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=silent, instantiate=False, objects=[‘silent’, ‘warn’, ‘error’, ‘none’], pickle_default_value=True, precedence=None, readonly=False)
Action to take when the output value will be clipped.
param NumericTuple input_limits (allow_None=False, constant=False, default=(0.0, 1.0), instantiate=False, length=2, pickle_default_value=True, precedence=None, readonly=False)
Upper and lower bounds to verify on input values.
convert(from_, to, what)[source]

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.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

dtype

alias of float32

force_new_dynamic_value = <functools.partial object at 0x2adfbcb3d7e0>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbcb3d838>
hsv_to_gammargb(HSV)[source]

hsv is already specifying gamma corrected rgb

hsv_to_rgb(HSV)[source]

hsv to linear rgb

inspect_value = <functools.partial object at 0x2adfbcb3d788>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

rgb_to_hsv(RGB)[source]

linear rgb to hsv

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbcb3d628>
set_param = <functools.partial object at 0x2adfbcb3d8e8>
state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

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.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.colorspaces.ColorConverter(**params)[source]

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

param ObjectSelector analysis_space (allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=HSV, instantiate=False, objects=[‘HSV’, ‘LCH’], pickle_default_value=True, precedence=None, readonly=False)
Color space in which analysis is performed.
param Parameter colorspace (allow_None=False, constant=False, default=<ColorSpace ColorSpace01042>, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Object to use for converting between color spaces.
param ObjectSelector working_space (allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=RGB, instantiate=False, objects=[‘RGB’, ‘LMS’], pickle_default_value=True, precedence=None, readonly=False)
Color space to which images will be transformed to provide working space to later stages of processing.
param ObjectSelector image_space (allow_None=None, check_on_set=True, compute_default_fn=None, constant=False, default=XYZ, instantiate=False, objects=[‘XYZ’, ‘LMS’, ‘RGB’], pickle_default_value=True, precedence=None, readonly=False)
Color space in which images are encoded.
analysis2display(a)[source]

Utility conversion function that transforms data from the analysis color space to the display space (currently hard-set to RGB) for visualization.

analysis2working(a)[source]

Convert back from the analysis color space to the working space.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbcb3d680>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbcb3d7e0>
image2working(i)[source]

Transform images i provided into the specified working color space.

inspect_value = <functools.partial object at 0x2adfbcb3d6d8>
jitter_hue(a, amount)[source]

Rotate the hue component of a by the given amount.

message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

multiply_sat(a, factor)[source]

Scale the saturation of a by the given amount.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbcb3d5d0>
set_param = <functools.partial object at 0x2adfbcb3d998>
state_pop()

Restore the most recently saved state.

See state_push() for more details.

state_push()

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.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

working2analysis(r)[source]

Transform working space inputs to the analysis color space.


deprecated Module

Inheritance diagram of imagen.deprecated

Old patterns not intended for new code.

These patterns are expected to be deleted eventually.

class imagen.deprecated.FileImage(**params)

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param ClassSelector pattern_sampler (allow_None=False, constant=False, default=<PatternSampler PatternSampler01045>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
The PatternSampler to use to resample/resize the image.
param Boolean cache_image (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If False, discards the image and pattern_sampler after drawing the pattern each time, to make it possible to use very large databases of images without running out of memory.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param HookList channel_transforms (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Optional functions to apply post processing to the set of channels.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Filename filename (allow_None=False, constant=False, default=images/ellen_arthur.pgm, instantiate=False, pickle_default_value=True, precedence=0.9, readonly=False, search_paths=[])
File path (can be relative to Param’s base path) to a bitmap image. The image can be in any format accepted by PIL, e.g. PNG, JPG, TIFF, or PGM as well or numpy save files (.npy or .npz) containing 2D or 3D arrays (where the third dimension is used for each channel).
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the width.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Height of the image.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c5368>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c53c0>
inspect_value = <functools.partial object at 0x2adfbc4c5418>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc4c5260>
set_matrix_dimensions(*args)

Subclassed to delete the cached image when matrix dimensions are changed.

set_param = <functools.partial object at 0x2adfbc4c5310>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.deprecated.Constant(**params)

Bases: imagen.patterngenerator.PatternGenerator

Constant pattern generator, i.e., a solid, uniform field of the same value.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c51b0>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c5158>
inspect_value = <functools.partial object at 0x2adfbc4c50a8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc4c54c8>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbc4c5208>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.deprecated.TwoRectangles(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Two 2D rectangle pattern generator.

param Number y2 (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y center of rectangle 2.
param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number y1 (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=-0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y center of rectangle 1.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.31, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of width to height; size*aspect_ratio gives the width of the rectangle.
param Number x1 (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=-0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X center of rectangle 1.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number x2 (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X center of rectangle 2.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c5470>
get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c5260>
inspect_value = <functools.partial object at 0x2adfbc4c5050>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc4c5418>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbc4c53c0>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.deprecated.Composite(**params)

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.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Parameter operator (allow_None=False, constant=False, default=<ufunc ‘maximum’>, instantiate=False, pickle_default_value=True, precedence=0.98, readonly=False)
Binary Numpy function used to combine the individual patterns. Any binary Numpy array “ufunc” returning the same type of array as the operands and supporting the reduce operator is allowed here. Supported ufuncs include:: add subtract multiply divide maximum minimum remainder power The most useful ones are probably add and maximum, but there are uses for at least some of the others as well (e.g. to remove pieces of other patterns). You can also write your own operators, by making a class that has a static method named “reduce” that returns an array of the same size and type as the arrays in the list. For example:: class return_first(object): @staticmethod def reduce(x): return x[0]
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param List generators (allow_None=False, bounds=(1, None), constant=False, default=[Constant(bounds=BoundingBox(radius=0.5), group=’Pattern’, mask=None, mask_shape=None, name=’Constant01030’, offset=0.0, orientation=0.0, output_fns=[], position=[0.0, 0.0], scale=0.0, size=1.0, x=0.0, xdensity=256, y=0.0, ydensity=256, z=None)], instantiate=True, pickle_default_value=True, precedence=0.97, readonly=False)
List of patterns to combine or select from. The default pattern is a blank pattern, and thus should be overridden for any useful work.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Scaling factor applied to all sub-patterns.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c54c8>
function(p)

Constructs combined pattern out of the individual ones.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c5100>
inspect_value = <functools.partial object at 0x2adfbc4c50a8>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

operator = <ufunc 'maximum'>
classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc4c53c0>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbc4c5208>
state_pop()

Pop the state of all generators

state_push()

Push the state of all generators

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.deprecated.OldSweeper(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

PatternGenerator that sweeps a supplied PatternGenerator in a direction perpendicular to its orientation.

param Number x (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X-coordinate location of pattern center.
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Parameter generator (allow_None=False, constant=False, default=<Gaussian Gaussian01049>, instantiate=False, pickle_default_value=True, precedence=0.97, readonly=False)
Pattern to sweep.
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y-coordinate location of pattern center.
param Number step (allow_None=False, bounds=None, constant=False, default=1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Number of steps at the given speed to move in the sweep direction. The distance moved is speed*step.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number speed (allow_None=False, bounds=(0.0, None), constant=False, default=0.25, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Sweep speed: number of sheet coordinate units per unit time.
param Number size (allow_None=False, bounds=(0.0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Determines the overall size of the pattern.
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c52b8>
function(p)[source]

Selects and returns one of the patterns in the list.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c5418>
inspect_value = <functools.partial object at 0x2adfbc4c5158>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.

set_dynamic_time_fn = <functools.partial object at 0x2adfbc4c5260>
set_matrix_dimensions(bounds, xdensity, ydensity)

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.

set_param = <functools.partial object at 0x2adfbc4c5310>
state_pop()

Restore the state of the output functions saved by state_push.

state_push()

Save the state of the output functions, to be restored with state_pop.

verbose(msg, *args, **kw)

Print msg merged with args as a verbose message.

See Python’s logging module for details of message formatting.

warning(msg, *args, **kw)

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.

class imagen.deprecated.GaussiansCorner(**params)[source]

Bases: imagen.patterngenerator.PatternGenerator

Two Gaussian pattern generators with a variable intersection point, appearing as a corner or cross.

param Number x (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=-0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.2, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
X center of the corner
param Number scale (allow_None=False, bounds=None, constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Multiplicative strength of input pattern, defaulting to 1.0
param String group (allow_None=False, basestring=<type ‘basestring’>, constant=False, default=Pattern, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
The group name assigned to the returned HoloViews object.
param Number angle (allow_None=False, bounds=(0, 3.141592653589793), constant=False, default=1.57079632679, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The angle of the corner
param Number orientation (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.4, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Polar angle of pattern, i.e., the orientation in the Cartesian coordinate system, with zero at 3 o’clock and increasing counterclockwise.
param Number aspect_ratio (allow_None=False, bounds=(0, None), constant=False, default=3.22580645161, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Ratio of the width to the height for both Gaussians
param ClassSelector z (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=-1, readonly=False)
The Dimension object associated with the z-values generated by the PatternGenerator . If None, uses the default set by HoloViews.Image.
param Parameter mask (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=-1, readonly=False)
Optional object (expected to be an array) with which to multiply the pattern array after it has been created, before any output_fns are applied. This can be used to shape the pattern.
param BoundingRegionParameter bounds (allow_None=False, constant=False, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=-1, readonly=False)
BoundingBox of the area in which the pattern is generated.
param Number cross (allow_None=False, bounds=(0, 1), constant=False, default=0.4, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Where the two Gaussians cross, as a fraction of their half length
param Number xdensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the x direction.
param Number y (allow_None=False, bounds=(-1.0, 1.0), constant=False, default=-0.15, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.21, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Y center of the corner
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=0.08, readonly=False)
Optional function(s) to apply to the pattern array after it has been created. Can be used for normalization, thresholding, etc.
param Number offset (allow_None=False, bounds=None, constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.11, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Additive offset to input pattern, defaulting to 0.0
param ClassSelector mask_shape (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=0.06, readonly=False)
Optional PatternGenerator used to construct a mask to be applied to the pattern.
param Composite position (allow_None=True, attribs=[‘x’, ‘y’], constant=False, default=None, instantiate=False, objtype=<class ‘imagen.patterngenerator.PatternGenerator’>, pickle_default_value=True, precedence=-1, readonly=False)
Coordinates of location of pattern center. Provides a convenient way to set the x and y parameters together as a tuple (x,y), but shares the same actual storage as x and y (and thus only position OR x and y need to be specified).
param Number ydensity (allow_None=False, bounds=(0, None), constant=False, default=256, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=-1, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
Density (number of samples per 1.0 length) in the y direction. Typically the same as the xdensity.
param Number size (allow_None=False, bounds=(0, None), constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=0.3, readonly=False, time_dependent=False, time_fn=<Time Time00001>)
The size of the corner
anim(duration, offset=0, timestep=1, label=None, unit=None, time_fn=Time(label='Time', name='Time00001', time_type=<type 'int'>, timestep=1.0, unit=None, until=Infinity()))

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(use_cached=False, **params_to_override)

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).

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

See Python’s logging module for details of message formatting.

defaults()

Return {parameter_name:parameter.default} for all non-constant Parameters.

Note that a Parameter for which instantiate==True has its default instantiated.

force_new_dynamic_value = <functools.partial object at 0x2adfbc4c50a8>
function(p)

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.

get_param_values(onlychanged=False)

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.

get_value_generator = <functools.partial object at 0x2adfbc4c5100>
inspect_value = <functools.partial object at 0x2adfbc4c5578>
message(msg, *args, **kw)

Print msg merged with args as a message.

See Python’s logging module for details of message formatting.

num_channels()

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).

classmethod params(parameter_name=None)

Return the Parameters of this class as the dictionary {name: parameter_object}

Includes Parameters from this class and its superclasses.

pprint(imports=None, prefix=' ', unknown_value='<?>', qualify=False, separator='')

(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.

classmethod print_param_defaults()

Print the default values of all cls’s Parameters.

print_param_values()

Print the values of all this object’s Parameters.

script_repr(imports=, []prefix=' ')

Variant of __repr__ designed for generating a runnable script.

classmethod set_default(param_name, value)

Set the default value of param_name.

Equivalent to setting param_name on the class.</