TransferFns: accept and modify a 2d array
Bases: imagen.transferfn.TransferFn
Forces all values below a threshold to zero, and above it to 1.0.
param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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>)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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>)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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>)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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>)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
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).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
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.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: imagen.transferfn.TransferFn
Forces all values below a threshold to zero, and leaves others unchanged.
param Parameter norm_value (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: param.parameterized.Parameterized
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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
Bases: 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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
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.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
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).
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
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.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
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.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.
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.
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)
Print msg merged with args as a debugging statement.
See Python’s logging module for details of message formatting.
Return {parameter_name:parameter.default} for all non-constant Parameters.
Note that a Parameter for which instantiate==True has its default instantiated.
Return a list of name,value pairs for all Parameters of this object.
If onlychanged is True, will only return values that are not equal to the default value.
Print msg merged with args as a message.
See Python’s logging module for details of message formatting.
Return the Parameters of this class as the dictionary {name: parameter_object}
Includes Parameters from this class and its superclasses.
(Experimental) Pretty printed representation that may be evaluated with eval. See pprint() function for more details.
Print the default values of all cls’s Parameters.
Print the values of all this object’s Parameters.
Variant of __repr__ designed for generating a runnable script.
Set the default value of param_name.
Equivalent to setting param_name on the class.
Restore the most recently saved state.
See state_push() for more details.
Save this instance’s state.
For Parameterized instances, this includes the state of dynamically generated values.
Subclasses that maintain short-term state should additionally save and restore that state using state_push() and state_pop().
Generally, this method is used by operations that need to test something without permanently altering the objects’ state.
Print msg merged with args as a verbose message.
See Python’s logging module for details of message formatting.
Print msg merged with args as a warning, unless module variable warnings_as_exceptions is True, then raise an Exception containing the arguments.
See Python’s logging module for details of message formatting.