imagen.transferfn Package


transferfn Package

Inheritance diagram of imagen.transferfn

TransferFns: accept and modify a 2d array

class imagen.transferfn.BinaryThreshold(**params)[source]

Bases: imagen.transferfn.TransferFn

Forces all values below a threshold to zero, and above it to 1.0.

param Number threshold (allow_None=False, bounds=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>)
Decision point for determining binary value.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb408e8>
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 0x2adfbeb40838>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40940>
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 0x2adfbeb40890>
set_param = <functools.partial object at 0x2adfbeb40a48>
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.transferfn.DivisiveNormalizeL1(**params)[source]

Bases: imagen.transferfn.TransferFn

TransferFn that divides an array by its L1 norm.

This operation ensures that the sum of the absolute values of the array is equal to the specified norm_value, rescaling each value to make this true. The array is unchanged if the sum of absolute values is zero. For arrays of non-negative values where at least one is non-zero, this operation is equivalent to a divisive sum normalization.

param Number norm_value (allow_None=False, bounds=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>)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40730>
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 0x2adfbeb406d8>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40788>
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 0x2adfbeb40628>
set_param = <functools.partial object at 0x2adfbeb40998>
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.transferfn.DivisiveNormalizeL2(**params)[source]

Bases: imagen.transferfn.TransferFn

TransferFn to divide an array by its Euclidean length (aka its L2 norm).

For a given array interpreted as a flattened vector, keeps the Euclidean length of the vector at a specified norm_value.

param Number norm_value (allow_None=False, bounds=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>)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb409f0>
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 0x2adfbeb40838>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40890>
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 0x2adfbeb40940>
set_param = <functools.partial object at 0x2adfbeb407e0>
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.transferfn.DivisiveNormalizeLinf(**params)[source]

Bases: imagen.transferfn.TransferFn

TransferFn to divide an array by its L-infinity norm (i.e. the maximum absolute value of its elements).

For a given array interpreted as a flattened vector, scales the elements divisively so that the maximum absolute value is the specified norm_value.

The L-infinity norm is also known as the divisive infinity norm and Chebyshev norm.

param Number norm_value (allow_None=False, bounds=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>)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40998>
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 0x2adfbeb40af8>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40ba8>
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 0x2adfbeb40ec0>
set_param = <functools.partial object at 0x2adfbeb40f70>
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.transferfn.DivisiveNormalizeLp(**params)[source]

Bases: imagen.transferfn.TransferFn

TransferFn to divide an array by its Lp-Norm, where p is specified.

For a parameter p and a given array interpreted as a flattened vector, keeps the Lp-norm of the vector at a specified norm_value. Faster versions are provided separately for the typical L1-norm and L2-norm cases. Defaults to be the same as an L2-norm, i.e., DivisiveNormalizeL2.

param Number p (allow_None=False, bounds=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>)

param Number norm_value (allow_None=False, bounds=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>)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40730>
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 0x2adfbeb40b50>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40ba8>
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 0x2adfbeb40af8>
set_param = <functools.partial object at 0x2adfbeb40c00>
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.transferfn.Hysteresis(**params)[source]

Bases: imagen.transferfn.TransferFnWithState

Smoothly interpolates a matrix between simulation time steps, with exponential falloff.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param Number time_constant (allow_None=False, bounds=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>)
Controls the time scale of the interpolation.
param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be temporarily turned off (e.g for analysis purposes).
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 0x2adfbeb40628>
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 0x2adfbeb40680>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

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

Print msg merged with args as a message.

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

override_plasticity_state(new_plasticity_state)

Temporarily disable plasticity of internal state.

This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern, and no call should have any effect that persists after restore_plasticity_state() is called.

By default, simply saves a copy of the ‘plastic’ parameter to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets the plastic parameter to the given value (True or False).

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.

restore_plasticity_state()

Re-enable plasticity of internal state after an override_plasticity_state call.

This function should be implemented by all subclasses to remove the effect of the most recent override_plasticity_state call, i.e. to reenable changes to the internal state, without any lasting effect from the time during which plasticity was disabled.

By default, simply restores the last saved value of the ‘plastic’ parameter.

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 0x2adfbeb40788>
set_param = <functools.partial object at 0x2adfbeb40a48>
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.transferfn.IdentityTF(**params)[source]

Bases: imagen.transferfn.TransferFn

Identity function, returning its argument as-is.

For speed, calling this function object is sometimes optimized away entirely. To make this feasible, it is not allowable to derive other classes from this object, modify it to have different behavior, add side effects, or anything of that nature.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40ba8>
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 0x2adfbeb40628>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40c58>
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 0x2adfbeb40730>
set_param = <functools.partial object at 0x2adfbeb40a48>
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.transferfn.Scale(**params)[source]

Bases: imagen.transferfn.TransferFn

Multiply the input array by some constant factor.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param Number scale (allow_None=False, bounds=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>)
The multiplicative factor that scales the input values.
param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40998>
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 0x2adfbeb40680>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40b50>
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 0x2adfbeb40ba8>
set_param = <functools.partial object at 0x2adfbeb40d08>
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.transferfn.Threshold(**params)[source]

Bases: imagen.transferfn.TransferFn

Forces all values below a threshold to zero, and leaves others unchanged.

param Number threshold (allow_None=False, bounds=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>)
Decision point for determining values to clip.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40628>
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 0x2adfbeb40998>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40c58>
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 0x2adfbeb40c00>
set_param = <functools.partial object at 0x2adfbeb40730>
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.transferfn.TransferFn(**params)[source]

Bases: param.parameterized.Parameterized

Function object to modify a matrix in place, e.g. for normalization.

Used for transforming an array of intermediate results into a final version, by cropping it, normalizing it, squaring it, etc.

Objects in this class must support being called as a function with one matrix argument, and are expected to change that matrix in place.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbeb40680>
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 0x2adfbeb40628>
initialize(**kwargs)[source]

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

inspect_value = <functools.partial object at 0x2adfbeb40ba8>
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 0x2adfbeb40788>
set_param = <functools.partial object at 0x2adfbeb40b50>
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.transferfn.TransferFnWithState(**params)[source]

Bases: imagen.transferfn.TransferFn

Abstract base class for TransferFns that need to maintain a self.plastic parameter.

These TransferFns typically maintain some form of internal history or other state from previous calls, which can be disabled by override_plasticity_state().

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether or not to update the internal state on each call. Allows plasticity to be temporarily turned off (e.g for analysis purposes).
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 0x2adfbeb40998>
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 0x2adfbeb40c58>
initialize(**kwargs)

Transfer functions may need additional information before the supplied numpy array can be modified in place. For instance, transfer functions may have state which needs to be allocated in memory with a certain size. In other cases, the transfer function may need to know about the coordinate system associated with the input data.

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

Print msg merged with args as a message.

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

override_plasticity_state(new_plasticity_state)[source]

Temporarily disable plasticity of internal state.

This function should be implemented by all subclasses so that after a call, the output should always be the same for any given input pattern, and no call should have any effect that persists after restore_plasticity_state() is called.

By default, simply saves a copy of the ‘plastic’ parameter to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets the plastic parameter to the given value (True or False).

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.

restore_plasticity_state()[source]

Re-enable plasticity of internal state after an override_plasticity_state call.

This function should be implemented by all subclasses to remove the effect of the most recent override_plasticity_state call, i.e. to reenable changes to the internal state, without any lasting effect from the time during which plasticity was disabled.

By default, simply restores the last saved value of the ‘plastic’ parameter.

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 0x2adfbeb40838>
set_param = <functools.partial object at 0x2adfbeb40d08>
state_pop()[source]

Restore the state saved by the most recent state_push call.

state_push()[source]

Save the current state onto a stack, to be restored with state_pop.

Subclasses must implement state_push and state_pop to store state across invocations. The behaviour should be such that after state_pop, the state is restored to what it was at the time when state_push was called.

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.

imagen.transferfn.norm(v, p=2)[source]

Returns the Lp norm of v, where p is an arbitrary number defaulting to 2.


sheet_tf Module

Inheritance diagram of imagen.transferfn.sheet_tf

A family of transfer functions that are aware of sheet coordinate systems.

The transfer functions in this file are allowed to make use of Imagen patterns and are to be supplied with an appropriate SheetCoordinateSystem object via the initialize method.

class imagen.transferfn.sheet_tf.Convolve(**params)[source]

Bases: imagen.transferfn.TransferFn

Transfer function that convolves the array data with the supplied kernel pattern.

The bounds and densities of the supplied kernel pattern do not affect the convolution operation. The spatial scale of the convolution is determined by the ‘size’ parameter of the kernel. The resulting convolution is applied of a spatial scale relative to the overall size of the input, as expressed in sheetcoordinates.

param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)

param ClassSelector kernel_pattern (allow_None=False, constant=False, default=<Gaussian Gaussian01054>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
The kernel pattern used in the convolution. The default kernel results in an isotropic Gaussian blur.
param List init_keys (allow_None=False, bounds=(0, None), constant=True, default=[‘SCS’], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of item key labels for metadata that that must be supplied to the initialize method before the TransferFn may be used.
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 0x2adfbe6ece10>
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 0x2adfbe6ece68>
inspect_value = <functools.partial object at 0x2adfbe6ecec0>
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 0x2adfbe6ecdb8>
set_param = <functools.partial object at 0x2adfbe6ecfc8>
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.


ImaGen

Table Of Contents

This Page