topo.sheet Package


sheet Package

Inheritance diagram of topo.sheet

Sheet classes.

A Sheet is a two-dimensional arrangement of processing units, typically modeling a neural region or a subset of cells in a neural region. Any new Sheet classes added to this directory will automatically become available for any model.

class topo.sheet.Sheet(**params)

Bases: topo.base.simulation.EventProcessor, holoviews.core.sheetcoords.SheetCoordinateSystem

The generic base class for neural sheets.

See SheetCoordinateSystem for how Sheet represents space, and EventProcessor for how Sheet handles time.

output_fns are functions that take an activity matrix and produce an identically shaped output matrix. The default is having no output_fns.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0af8>
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 0x2b07af1b0cb0>
input_event(conn, data)

Called by the simulation when an EPConnectionEvent is delivered; the EventProcessor should process the data somehow.

inspect_value = <functools.partial object at 0x2b07af1b0ba8>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

process_current_time()

Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af1b0db8>
set_param = <functools.partial object at 0x2b07ab259e10>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.SettlingCFSheet(**params)[source]

Bases: topo.sheet.JointNormalizingCFSheet

A JointNormalizingCFSheet implementing the idea of settling.

Breaks continuous time up into discrete iterations, each consisting of a series of activations, up to a fixed number of settling steps. Settling is controlled by the tsettle parameter; once that number of settling steps has been reached, an external input is required before the sheet will activate again.

See the LISSOM algorithm (Sirosh and Miikkulainen, Biological Cybernetics 71:66-78, 1994) for one example of its usage.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Boolean continuous_learning (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to modify the weights after every settling step. If false, waits until settling is completed before doing learning.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.6, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Integer mask_init_time (allow_None=False, bounds=(0, None), constant=False, default=5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Determines when a new mask is initialized in each new iteration. The mask is reset whenever new input comes in. Once the activation_count (see tsettle) reaches mask_init_time, the mask is initialized to reflect the current activity profile.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param HookList beginning_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the beginning of each iteration.
param Integer tsettle (allow_None=False, bounds=(0, None), constant=False, default=8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Number of times to activate the SettlingCFSheet sheet for each external input event. A counter is incremented each time an input is received from any source, and once the counter reaches tsettle, the last activation step is skipped so that there will not be any further recurrent activation. The next external (i.e., afferent or feedback) event will then start the counter over again.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param HookList post_initialization_weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
If not empty, weights output_fns that will replace the existing ones after an initial normalization step.
param HookList end_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the end of each iteration.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Parameter strict_tsettle (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If non-None, delay sending output until activation_count reaches this value.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0e10>
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 0x2b07af1b0db8>
inspect_value = <functools.partial object at 0x2b07af1b0a48>
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()[source]

Pass the accumulated stimulation through self.output_fns and send it out on the default output port.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)[source]

Send some data out to all connections on the given src_port.

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 0x2b07ab259cb0>
set_param = <functools.partial object at 0x2b07ab259fc8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.CFSheet(**params)

Bases: topo.base.projection.ProjectionSheet

A ProjectionSheet providing access to the ConnectionFields in its CFProjections.

CFSheet is a Sheet built from units indexed by Sheet coordinates (x,y). Each unit can have one or more ConnectionFields on another Sheet (via this sheet’s CFProjections). Thus CFSheet is a more concrete version of a ProjectionSheet; a ProjectionSheet does not require that there be units or weights of any kind. Unless you need access to the underlying ConnectionFields for visualization or analysis, CFSheet and ProjectionSheet are interchangeable.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0e10>
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 0x2b07af1b0ba8>
input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

inspect_value = <functools.partial object at 0x2b07af1b0cb0>
learn()

By default, call the learn() and apply_learn_output_fns() methods on every Projection to this Sheet.

Any other type of learning can be implemented by overriding this method. Called from self.process_current_time() _after_ activity has been propagated.

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Called by the simulation after all the events are processed for the current time but before time advances. Allows the event processor to send any events that must be sent before time advances to drive the simulation.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07ab259ec0>
set_param = <functools.partial object at 0x2b07ab259aa0>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Subclasses Sheet state_pop to also pop projection activities.

state_push()

Subclasses Sheet state_push to also push projection activities.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.GeneratorSheet(**params)

Bases: topo.base.sheet.Sheet

Sheet for generating a series of 2D patterns.

Typically generates the patterns by choosing parameters from a random distribution, but can use any mechanism.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant01288>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0e10>
generate()

Generate the output and send it out the Activity port.

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 0x2b07af1b0a48>
inspect_value = <functools.partial object at 0x2b07af1b0af8>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

pop_input_generator()

Discard the current input_generator, and retrieve the previous one from the stack.

Warns if no input_generator is available on the stack.

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.

process_current_time()

Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

push_input_generator()

Push the current input_generator onto a stack for future retrieval.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07ab259aa0>
set_input_generator(new_ig, push_existing=False)

Set the input_generator, overwriting the existing one by default.

If push_existing is false, the existing input_generator is discarded permanently. Otherwise, the existing one is put onto a stack, and can later be restored by calling pop_input_generator.

set_param = <functools.partial object at 0x2b07ab259af8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.ProjectionSheet(**params)

Bases: topo.base.sheet.Sheet

A Sheet whose activity is computed using Projections from other sheets.

A standard ProjectionSheet expects its input to be generated from other Sheets. Upon receiving an input event, the ProjectionSheet interprets the event data to be (a copy of) an activity matrix from another sheet. The ProjectionSheet provides a copy of this matrix to each Projection from that input Sheet, asking each one to compute their own activity in response. The same occurs for any other pending input events.

After all events have been processed for a given time, the ProjectionSheet computes its own activity matrix using its activate() method, which by default sums all its Projections’ activity matrices and passes the result through user-specified output_fns() before sending it out on the default output port. The activate() method can be overridden to sum some of the projections, multiply that by the sum of other projections, etc., to model modulatory or other more complicated types of connections.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0ba8>
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 0x2b07af1b0cb0>
input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

inspect_value = <functools.partial object at 0x2b07af1b0f18>
learn()

By default, call the learn() and apply_learn_output_fns() methods on every Projection to this Sheet.

Any other type of learning can be implemented by overriding this method. Called from self.process_current_time() _after_ activity has been propagated.

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Called by the simulation after all the events are processed for the current time but before time advances. Allows the event processor to send any events that must be sent before time advances to drive the simulation.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07ab259e68>
set_param = <functools.partial object at 0x2b07ab259af8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Subclasses Sheet state_pop to also pop projection activities.

state_push()

Subclasses Sheet state_push to also push projection activities.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.SequenceGeneratorSheet(**params)[source]

Bases: topo.base.generatorsheet.GeneratorSheet

Sheet that generates a timed sequence of patterns.

This sheet will repeatedly generate the input_sequence, with the given onsets. The sequence is repeated every self.period time units. If the total length of the sequence is longer than self.period, a warning is issued and the sequence repeats immediately after completion.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant01288>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param List input_sequence (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
The sequence of patterns to generate. Must be a list of (onset,generator) tuples. An empty list defaults to the single tuple: (0,self.input_generator), resulting in identical behavior to an ordinary GeneratorSheet.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af1b0d08>
generate()

Generate the output and send it out the Activity port.

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 0x2b07af1b0af8>
inspect_value = <functools.partial object at 0x2b07af1b0d60>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

pop_input_generator()

Discard the current input_generator, and retrieve the previous one from the stack.

Warns if no input_generator is available on the stack.

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.

process_current_time()

Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

push_input_generator()

Push the current input_generator onto a stack for future retrieval.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07ab259af8>
set_input_generator(new_ig, push_existing=False)

Set the input_generator, overwriting the existing one by default.

If push_existing is false, the existing input_generator is discarded permanently. Otherwise, the existing one is put onto a stack, and can later be restored by calling pop_input_generator.

set_param = <functools.partial object at 0x2b07ab259db8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.ChannelGeneratorSheet(**params)

Bases: topo.base.generatorsheet.GeneratorSheet

A GeneratorSheet that handles input patterns with multiple simultaneous channels.

Accepts either a single-channel or an NChannel input_generator. If the input_generator stores separate channel patterns, it is used as-is; if other (single-channel) PatternGenerators are used, the Class behaves like a normal GeneratorSheet.

When a pattern is generated, the average of the channels is sent out on the Activity port as usual for a GeneratorSheet, and channel activities are sent out on the Activity0, Activity1, ..., ActivityN-1 ports. Thus this class can be used just like GeneratorSheet, but with optional color channels available, too.

If the input_generator is NChannel, this GeneratorSheet will handle the separate channels and create the specific output ports. If the input_generator is single-channel (eg, a monochrome image) then this GeneratorSheet will behave as a normal non-NChannel GeneratorSheet.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number constant_mean_total_channels_output (allow_None=True, bounds=None, constant=False, default=None, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
If set, it enforces the average of the mean channel values to be fixed. Eg, M = ( activity0+activity1+...+activity(N-1) ).mean() / N = constant_mean_total_channels_output
param Dict channel_output_fns (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Dictionary with arrays of channel-specific output functions: eg, {0:[fnc1, fnc2],3:[fnc3]}. The dictionary isn’t required to specify every channel, but rather only those required.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant01288>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07ab259db8>
generate()

Works as in the superclass, but also generates NChannel output and sends it out on the Activity0, Activity1, ..., ActivityN ports.

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 0x2b07af0d37e0>
inspect_value = <functools.partial object at 0x2b07af0d3628>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

pop_input_generator()

Discard the current input_generator, and retrieve the previous one from the stack.

Warns if no input_generator is available on the stack.

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.

process_current_time()

Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

push_input_generator()

Push the current input_generator onto a stack for future retrieval.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07aef10470>
set_input_generator(new_ig, push_existing=False)

If single-channel generators are used, the Class reverts to a simple GeneratorSheet behavior. If NChannel inputs are used, it will update the number of channels of the ChannelGeneratorSheet to match those of the input. If the number of channels doesn’t change, there’s no need to reset.

set_param = <functools.partial object at 0x2b07aef10368>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.JointNormalizingCFSheet(**params)[source]

Bases: topo.base.cf.CFSheet

A type of CFSheet extended to support joint sum-based normalization.

For L1 normalization, joint normalization means normalizing the sum of (the absolute values of) all weights in a set of corresponding CFs in different Projections, rather than only considering weights in the same CF.

This class provides a mechanism for grouping Projections (see _port_match and _grouped_in_projections) and a learn() function that computes the joint sums. Joint normalization also requires having ConnectionField store and return a norm_total for each neuron, and having an TransferFn that will respect this norm_total rather than the strict total of the ConnectionField’s weights. At present, CFPOF_DivisiveNormalizeL1 and CFPOF_DivisiveNormalizeL1_opt do use norm_total; others can be extended to do something similar if necessary.

To enable joint normalization, you can declare that all the incoming connections that should be normalized together each have a dest_port of:

dest_port=(‘Activity’,’JointNormalize’, ‘AfferentGroup1’),

Then all those that have this dest_port will be normalized together, as long as an appropriate TransferFn is being used.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af0d3788>
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 0x2b07af0d37e0>
input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

inspect_value = <functools.partial object at 0x2b07af0d3628>
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()[source]

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Called by the simulation after all the events are processed for the current time but before time advances. Allows the event processor to send any events that must be sent before time advances to drive the simulation.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07aef102b8>
set_param = <functools.partial object at 0x2b07aef10d08>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Subclasses Sheet state_pop to also pop projection activities.

state_push()

Subclasses Sheet state_push to also push projection activities.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.ActivityCopy(**params)[source]

Bases: topo.base.sheet.Sheet

Copies incoming Activity patterns to its activity matrix and output port.

Trivial Sheet class that is useful primarily as a placeholder for data that is computed elsewhere but that you want to appear as a Sheet, e.g. when wrapping an external simulation.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07ab259af8>
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 0x2b07ab259aa0>
inspect_value = <functools.partial object at 0x2b07ab259e68>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07aef10940>
set_param = <functools.partial object at 0x2b07aef102b8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.JointNormalizingCFSheet_Continuous(**params)[source]

Bases: topo.sheet.JointNormalizingCFSheet

CFSheet that runs continuously, with no ‘resting’ periods between pattern presentations.

Note that learning occurs only when the time is a whole number.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07ab259aa0>
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 0x2b07ab259e68>
input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

inspect_value = <functools.partial object at 0x2b07ab259cb0>
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07aef10940>
set_param = <functools.partial object at 0x2b07aef10af8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

state_pop()

Subclasses Sheet state_pop to also pop projection activities.

state_push()

Subclasses Sheet state_push to also push projection activities.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

topo.sheet.compute_joint_norm_totals(projlist, active_units_mask=True)[source]

Compute norm_total for each CF in each projection from a group to be normalized jointly.

class topo.sheet.BoundingBox(**args)

Bases: holoviews.core.boundingregion.BoundingRegion

A rectangular bounding box defined either by two points forming an axis-aligned rectangle (or simply a radius for a square).

centroid()

Return the coordinates of the center of this BoundingBox

contains(x, y)

Returns true if the given point is contained within the bounding box, where all boundaries of the box are considered to be inclusive.

contains_exclusive(x, y)

Return True if the given point is contained within the bounding box, where the bottom and right boundaries are considered exclusive.

containsbb_exclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, where at least one of the boundaries of the box has to be exclusive.

containsbb_inclusive(x)

Returns true if the given BoundingBox x is contained within the bounding box, including cases of exact match.

lbrt()

return left,bottom,right,top values for the BoundingBox.

upperexclusive_contains(x, y)

Returns true if the given point is contained within the bounding box, where the right and upper boundaries are exclusive, and the left and lower boundaries are inclusive. Useful for tiling a plane into non-overlapping regions.

topo.sheet.activity_type

alias of float64


composer Module

Inheritance diagram of topo.sheet.composer

A Sheet class for composing activity from different sheets into a single activity matrix. Primarily a simple example of how to make a sheet class, but can also be useful.

class topo.sheet.composer.Composer(**params)[source]

Bases: topo.base.sheet.Sheet

A Sheet that combines the activity of 2 or more other sheets into a single activity matrix. When connecting a sheet to a composer, you can specify the location at which that sheet’s input will be mapped into the composer by adding the ‘origin’ argument to the connect() call e.g.:

sim.connect(input_sheet.name,composer.name,delay=1, origin=(0.25,0.25))

will cause (0,0) on input sheet’s activity to map to (0.25,0.25) on composer’s activity.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af4f4b50>
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 0x2b07af4f4d60>
inspect_value = <functools.partial object at 0x2b07af4f4e68>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

port_configure(port, **config)[source]

Configure a specific input port.

origin = (default (0,0)) The offset in the output matrix where this port’s input should be placed.

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af4f4f70>
set_param = <functools.partial object at 0x2b07af4f4fc8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.


lissom Module

Inheritance diagram of topo.sheet.lissom

Specific support for the LISSOM algorithm.

topo.sheet.lissom.schedule_events(sheet_str="topo.sim['V1']", st=0.5, aff_name='Afferent', ids=1.0, ars=1.0, increase_inhibition=False)[source]

Convenience function for scheduling a default set of events typically used with a LISSOM model sheet. The parameters used are the defaults from Miikkulainen, Bednar, Choe, and Sirosh (2005), Computational Maps in the Visual Cortex, Springer.

Note that Miikulainen 2005 specifies only one output_fn for the LISSOM model sheet; where these scheduled actions operate on an output_fn, they do so only on the first output_fn in the sheet’s list of output_fns.

Installs afferent learning rate changes for any projection whose name contains the keyword specified by aff_name (typically “Afferent”).

The st argument determines the timescale relative to a 20000-iteration simulation, and results in the default 10000-iteration simulation for the default st=0.5.

The ids argument specifies the input density scale, i.e. how much input there is at each iteration, on average, relative to the default. The ars argument specifies how much to scale the afferent learning rate, if necessary.

If increase_inhibition is true, gradually increases the strength of the inhibitory connection, typically used for natural image simulations.


optimized Module

Inheritance diagram of topo.sheet.optimized

Inline-optimized Sheet classes

topo.sheet.optimized.compute_joint_norm_totals(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

class topo.sheet.optimized.SettlingCFSheet(**params)

Bases: topo.sheet.JointNormalizingCFSheet

A JointNormalizingCFSheet implementing the idea of settling.

Breaks continuous time up into discrete iterations, each consisting of a series of activations, up to a fixed number of settling steps. Settling is controlled by the tsettle parameter; once that number of settling steps has been reached, an external input is required before the sheet will activate again.

See the LISSOM algorithm (Sirosh and Miikkulainen, Biological Cybernetics 71:66-78, 1994) for one example of its usage.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Boolean continuous_learning (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to modify the weights after every settling step. If false, waits until settling is completed before doing learning.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.6, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Integer mask_init_time (allow_None=False, bounds=(0, None), constant=False, default=5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Determines when a new mask is initialized in each new iteration. The mask is reset whenever new input comes in. Once the activation_count (see tsettle) reaches mask_init_time, the mask is initialized to reflect the current activity profile.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param HookList beginning_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the beginning of each iteration.
param Integer tsettle (allow_None=False, bounds=(0, None), constant=False, default=8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Number of times to activate the SettlingCFSheet sheet for each external input event. A counter is incremented each time an input is received from any source, and once the counter reaches tsettle, the last activation step is skipped so that there will not be any further recurrent activation. The next external (i.e., afferent or feedback) event will then start the counter over again.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param HookList post_initialization_weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
If not empty, weights output_fns that will replace the existing ones after an initial normalization step.
param HookList end_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the end of each iteration.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Callable joint_norm_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Parameter strict_tsettle (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If non-None, delay sending output until activation_count reaches this value.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses may override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af5a4838>
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 0x2b07af5a4940>
inspect_value = <functools.partial object at 0x2b07af5a4998>
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Pass the accumulated stimulation through self.output_fns and send it out on the default output port.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port.

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 0x2b07af061368>
set_param = <functools.partial object at 0x2b07af0613c0>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.optimized.NeighborhoodMask(sheet, **params)

Bases: topo.base.projection.SheetMask

A SheetMask where the mask includes a neighborhood around active neurons.

Given a radius and a threshold, considers a neuron active if at least one neuron in the radius is over the threshold.

param Number threshold (allow_None=False, bounds=(0, None), constant=False, default=1e-05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Threshold for considering a neuron active. This value should be small to avoid discarding significantly active neurons.
param Number radius (allow_None=False, bounds=(0, None), constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Radius in Sheet coordinates around active neurons to consider neighbors active as well. Using a larger radius ensures that the calculation will be unaffected by the mask, but it will reduce any computational benefit from the mask.
data

Ensure that whenever somebody accesses the data they are not None.

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 0x2b07af5a4998>
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 0x2b07af5a4aa0>
inspect_value = <functools.partial object at 0x2b07af5a4a48>
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.

reset()

Initialize mask to default value (with no neurons masked out).

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 0x2b07af5a4f18>
set_param = <functools.partial object at 0x2b07af5a4f70>
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.

update()

Update the current mask based on the current activity and a previous mask.

Should be called only if calculate() has already been called since the last reset(); potentially faster to compute than redoing the entire calculate().

Subclasses should override this method to compute some non-default mask.

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.


ptztracker Module

Inheritance diagram of topo.sheet.ptztracker

This class finds the brightest pixel of the image, returns it in white and other in black. This class also gives instructions to move the camera.

class topo.sheet.ptztracker.PtzTracker(**params)[source]

Bases: topo.base.sheet.Sheet

Given an incoming Activity pattern, find the brightest pixel and output an activity pattern where all but this pixel is set to zero. Also controls a pan/tilt/zoom camera, instructing it to move so that the brightest pixel will be in the center of the sheet.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number ratio (allow_None=False, bounds=None, constant=False, default=1.33, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Ratio depends of the resolution of the camera, here 640x480.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Number fov_y (allow_None=False, bounds=None, constant=False, default=57, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along y in degrees. It is calculate with the resolution of the camera, and its field of view. It also depends of the bounds used, here the size_normalization used is “fit_shortest”. So Sheet coordinates along y for camera’s image are between -0.5 and 0.5. The original calculation is fov_y=fov_x*0.5*2/ratio.
param Number fov_x (allow_None=False, bounds=None, constant=False, default=76, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along x in degrees, depends of the camera.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param ClassSelector ptz (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
An instance of ptzcamera.PTZ to be controlled.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Number maxrange_x (allow_None=False, bounds=None, constant=False, default=4480, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along x.
param Number maxrange_y (allow_None=False, bounds=None, constant=False, default=1920, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along y.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

determine_next_position(img)[source]

Determine the next location to move in the specified image, using whatever criterion is appropriate for this class. Returns a tuple of (pos,bbox), where pos is the (row,column) coordinate of the next position, and bbox is a bounding box around that coordinate, with whatever size is appropriate for this class. Returns None if no appropriate location can be found.

draw_boxes(input_data, bboxmin, bboxmax)[source]

Draws three boxes arond the returned location.

force_new_dynamic_value = <functools.partial object at 0x2b07af88d578>
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 0x2b07af88d6d8>
inspect_value = <functools.partial object at 0x2b07af88d730>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

move_camera(pos, bboxmin, bbboxmax, brightpixel)[source]

Move the camera to centre the returned location.

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af88de68>
set_param = <functools.partial object at 0x2b07af88df18>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.ptztracker.BrightPixelTracker(**params)[source]

Bases: topo.sheet.ptztracker.PtzTracker

This class is used to define the position of the brightest pixel in the image.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number ratio (allow_None=False, bounds=None, constant=False, default=1.33, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Ratio depends of the resolution of the camera, here 640x480.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Number fov_y (allow_None=False, bounds=None, constant=False, default=57, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along y in degrees. It is calculate with the resolution of the camera, and its field of view. It also depends of the bounds used, here the size_normalization used is “fit_shortest”. So Sheet coordinates along y for camera’s image are between -0.5 and 0.5. The original calculation is fov_y=fov_x*0.5*2/ratio.
param Number fov_x (allow_None=False, bounds=None, constant=False, default=76, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along x in degrees, depends of the camera.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param ClassSelector ptz (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
An instance of ptzcamera.PTZ to be controlled.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Number maxrange_x (allow_None=False, bounds=None, constant=False, default=4480, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along x.
param Number maxrange_y (allow_None=False, bounds=None, constant=False, default=1920, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along y.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

draw_boxes(input_data, bboxmin, bboxmax)

Draws three boxes arond the returned location.

force_new_dynamic_value = <functools.partial object at 0x2b07af88d628>
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 0x2b07af88d838>
inspect_value = <functools.partial object at 0x2b07af88d8e8>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

move_camera(pos, bboxmin, bbboxmax, brightpixel)

Move the camera to centre the returned location.

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af88d050>
set_param = <functools.partial object at 0x2b07af88d158>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.ptztracker.FaceTracker(**params)[source]

Bases: topo.sheet.ptztracker.PtzTracker

This class is used to detect face in the image and draws a rectangle around each detected face.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number ratio (allow_None=False, bounds=None, constant=False, default=1.33, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Ratio depends of the resolution of the camera, here 640x480.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Number fov_y (allow_None=False, bounds=None, constant=False, default=57, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along y in degrees. It is calculate with the resolution of the camera, and its field of view. It also depends of the bounds used, here the size_normalization used is “fit_shortest”. So Sheet coordinates along y for camera’s image are between -0.5 and 0.5. The original calculation is fov_y=fov_x*0.5*2/ratio.
param Number fov_x (allow_None=False, bounds=None, constant=False, default=76, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Field of view along x in degrees, depends of the camera.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param ClassSelector ptz (allow_None=True, constant=False, default=None, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
An instance of ptzcamera.PTZ to be controlled.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Number maxrange_x (allow_None=False, bounds=None, constant=False, default=4480, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along x.
param Number maxrange_y (allow_None=False, bounds=None, constant=False, default=1920, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Maximum position of the camera along y.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

draw_boxes(input_data, bboxmin, bboxmax)

Draws three boxes arond the returned location.

force_new_dynamic_value = <functools.partial object at 0x2b07af88d998>
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 0x2b07af88daa0>
inspect_value = <functools.partial object at 0x2b07af88db50>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

move_camera(pos, bboxmin, bbboxmax, brightpixel)

Move the camera to centre the returned location.

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af88d0a8>
set_param = <functools.partial object at 0x2b07af88d418>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.


saccade Module

Inheritance diagram of topo.sheet.saccade

Sheets for simulating a moving eye.

This module provides two classes, ShiftingGeneratorSheet, and SaccadeController, that can be used to simulate a moving eye, controlled by topographic neural activity from structures like the superior colliculus.

ShiftingGeneratorSheet is a subclass of GeneratorSheet that accepts a saccade command on the ‘Saccade’ port in the form of a tuple: (amplitude,direction), specified in degrees. It shifts its sheet bounds in response to this command, keeping the centroid of the bounds within a prespecified boundingregion.

SaccadeController is a subclass of CFSheet that accepts CF projections and decodes its resulting activity into a saccade command suitable for controlling a ShiftingGeneratorSheet.

class topo.sheet.saccade.SaccadeController(**params)[source]

Bases: topo.base.cf.CFSheet

Sheet that decodes activity on CFProjections into a saccade command.

This class accepts CF-projected input and computes its activity like a normal CFSheet, then decodes that activity into a saccade amplitude and direction as would be specified by activity in the superior colliculi. The X dimension of activity corresponds to amplitude, the Y dimension to direction. The activity is decoded to a single (x,y) point according to the parameter decode_method.

From this (x,y) point an (amplitude,direction) pair, specified in degrees, is computed using the parameters amplitude_scale and direction scale. That pair is then sent out on the ‘Saccade’ output port.

NOTE: Non-linear mappings for saccade commands, as in Ottes, et al (below), are assumed to be provided using the coord_mapperg parameter of the incoming CFProjection.

References: Ottes, van Gisbergen, Egglermont. 1986. Visuomotor fields of the superior colliculus: a quantitative model. Vision Research; 26(6): 857-73.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Number direction_scale (allow_None=False, bounds=None, constant=False, default=180, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Scale factor for saccade command direction, expressed in degrees per unit of sheet. Indicates what direction of saccade is represented by the y-component of the command input.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number amplitude_scale (allow_None=False, bounds=None, constant=False, default=120, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Scale factor for saccade command amplitude, expressed in degrees per unit of sheet. Indicates how large a saccade is represented by the x-component of the command input.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param ClassSelector command_mapper (allow_None=False, constant=False, default=<IdentityMF IdentityMF01515>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A CoordinateMapperFn that will be applied to the command vector extracted from the sheet activity.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Callable decode_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
The function for extracting a single point from sheet activity. Should take a sheet as the first argument, and return (x,y).
activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

debug(msg, *args, **kw)

Print msg merged with args as a debugging statement.

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

static decode_fn(sheet, activity=None, threshold=0.0)

Return the sheet coords of the (weighted) centroid of sheet activity.

If the activity argument is not None, then it is used instead of sheet.activity. If the sheet activity is all zero, the centroid of the sheet bounds is returned.

defaults()

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

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

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07aef34db8>
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 0x2b07aef34b50>
input_event(conn, data)

Accept input from some sheet. Call .present_input() to compute the stimulation from that sheet.

inspect_value = <functools.partial object at 0x2b07aef34e10>
learn()

By default, call the learn() and apply_learn_output_fns() methods on every Projection to this Sheet.

Any other type of learning can be implemented by overriding this method. Called from self.process_current_time() _after_ activity has been propagated.

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Called by the simulation after all the events are processed for the current time but before time advances. Allows the event processor to send any events that must be sent before time advances to drive the simulation.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af7a0050>
set_param = <functools.partial object at 0x2b07af7a0100>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

start()

Called by the simulation when the EventProcessor is added to the simulation.

If an EventProcessor needs to have any code run when it is added to the simulation, the code can be put into this method in the subclass.

state_pop()

Subclasses Sheet state_pop to also pop projection activities.

state_push()

Subclasses Sheet state_push to also push projection activities.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

class topo.sheet.saccade.ShiftingGeneratorSheet(**params)[source]

Bases: topo.sheet.SequenceGeneratorSheet

A GeneratorSheet that takes an extra input on port ‘Saccade’ that specifies a saccade command as a tuple (amplitude,direction), indicating the relative size and direction of the saccade in degrees. The parameter visual_angle_scale defines the relationship between degrees and sheet coordinates. The parameter saccade bounds limits the region within which the saccades may occur.

param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number fixation_jitter_period (allow_None=False, bounds=None, constant=False, default=10, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Period, in time units, indicating how often the eye jitters.
param ClassSelector input_generator (allow_None=False, constant=False, default=<Constant Constant01288>, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
Specifies a particular PatternGenerator type to use when creating patterns.
param Number precedence (allow_None=False, bounds=None, constant=False, default=0.1, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param BoundingRegionParameter saccade_bounds (allow_None=False, constant=False, default=BoundingBox(radius=1.0), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
The bounds for saccades. Saccades are constrained such that the centroid of the sheet bounds remains within this region.
param Boolean generate_on_shift (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to generate a new pattern when a shift occurs.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Number fixation_jitter (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=True, time_fn=<Time Time00001>)
Standard deviation of Gaussian fixation jitter.
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Number period (allow_None=False, bounds=(0, None), constant=True, default=1, inclusive_bounds=(False, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay (in Simulation time) between generating new input patterns.
param Number phase (allow_None=False, bounds=None, constant=False, default=0.05, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Delay after the start of the Simulation (at time zero) before generating an input pattern. For a clocked, feedforward simulation, one would typically want to use a small nonzero phase and use delays less than the user-visible step size (typically 1.0), so that inputs are generated and processed before this step is complete.
param List input_sequence (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
The sequence of patterns to generate. Must be a list of (onset,generator) tuples. An empty list defaults to the single tuple: (0,self.input_generator), resulting in identical behavior to an ordinary GeneratorSheet.
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Number visual_angle_scale (allow_None=False, bounds=None, constant=False, default=90, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
The scale factor determining the visual angle subtended by this sheet, in degrees per unit of sheet.
activate()

Collect activity from each projection, combine it to calculate the activity for this sheet, and send the result out.

Subclasses will need to override this method to whatever it means to calculate activity in that subclass.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07aef34ec0>
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 0x2b07aef34db8>
inspect_value = <functools.partial object at 0x2b07aef34c00>
matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Return a lower bound for the memory taken by this sheet, in bytes.

Typically, this number will include the activity array and any similar arrays, plus any other significant data owned (in some sense) by this Sheet. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity of medium and long term internal state.

This function should be implemented by all subclasses so that it preserves the ability of the Sheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state (if new_plasticity_state=False).

Any operation that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, simply saves a copy of the plastic flag to an internal stack (so that it can be restored by restore_plasticity_state()), and then sets plastic to new_plasticity_state.

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.

pop_input_generator()

Discard the current input_generator, and retrieve the previous one from the stack.

Warns if no input_generator is available on the stack.

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.

process_current_time()

Called by the simulation before advancing the simulation time. Allows the event processor to do any computation that requires that all events for this time have been delivered. Computations performed in this method should not generate any events with a zero time delay, or else causality could be violated. (By default, does nothing.)

push_input_generator()

Push the current input_generator onto a stack for future retrieval.

refixate()[source]

Move the bounds toward the fixation point.

Moves the bounds toward the fixation point specified in self.fixation_point, potentially with noise as specified by the parameter self.fixation_jitter.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

restore_plasticity_state()

Restores plasticity of medium and long term internal state after a 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 restore plasticity of any type that was overridden.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port. The data is deepcopied before it is sent out, to ensure that future changes to the data are not reflected in events from the past.

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 0x2b07af832100>
set_input_generator(new_ig, push_existing=False)

Set the input_generator, overwriting the existing one by default.

If push_existing is false, the existing input_generator is discarded permanently. Otherwise, the existing one is put onto a stack, and can later be restored by calling pop_input_generator.

set_param = <functools.partial object at 0x2b07af8320a8>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

shift(amplitude, direction, generate=None)[source]

Shift the bounding box by the given amplitude and direction.

Amplitude and direction are specified in degrees, and will be converted using the sheet’s visual_angle_scale parameter. Negative directions are always downward, regardless of whether the amplitude is positive (rightword) or negative (leftward). I.e. straight-down = -90, straight up = +90.

The generate argument indicates whether or not to generate output after shifting. If generate is None, then the value of the sheet’s generate_on_shift parameter will be used.

state_pop()

Pop the most recently saved state off the stack.

See state_push() for more details.

state_push()

Save the current state of this sheet to an internal stack.

This method is used by operations that need to test the response of the sheet without permanently altering its state, e.g. for measuring maps or probing the current behavior non-invasively. By default, only the activity pattern of this sheet is saved, but subclasses should add saving for any additional state that they maintain, or strange bugs are likely to occur. The state can be restored using state_pop().

Note that Sheets that do learning need not save the values of all connection weights, if any, because plasticity can be turned off explicitly. Thus this method is intended only for shorter-term 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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.

topo.sheet.saccade.activity_centroid(sheet, activity=None, threshold=0.0)[source]

Return the sheet coords of the (weighted) centroid of sheet activity.

If the activity argument is not None, then it is used instead of sheet.activity. If the sheet activity is all zero, the centroid of the sheet bounds is returned.

topo.sheet.saccade.activity_sample(sheet, activity=None)[source]

Sample from the sheet activity as if it were a probability distribution.

Returns the sheet coordinates of the sampled unit. If activity is not None, it is used instead of sheet.activity.

topo.sheet.saccade.activity_mode(sheet, activity=None)[source]

Returns the sheet coordinates of the mode (highest value) of the sheet activity.


slissom Module

Inheritance diagram of topo.sheet.slissom

The SLISSOM class.

class topo.sheet.slissom.SLISSOM(**params)[source]

Bases: topo.sheet.SettlingCFSheet

A Sheet class implementing the SLISSOM algorithm (Choe and Miikkulainen, Neurocomputing 21:139-157, 1998).

A SLISSOM sheet is a SettlingCFSheet sheet extended to include spiking neurons using dynamic synapses.

param Number precedence (allow_None=False, bounds=None, constant=False, default=0.6, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows a sorting order for Sheets, e.g. in the GUI.
param Callable joint_norm_fn (allow_None=False, constant=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Function to use to compute the norm_total for each CF in each projection from a group to be normalized jointly.
param HookList beginning_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the beginning of each iteration.
param Number threshold (allow_None=False, bounds=(0, None), constant=False, default=0.3, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Baseline threshold
param Number dynamic_threshold_init (allow_None=False, bounds=(0, None), constant=False, default=2.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Initial value for dynamic threshold when spike occurs
param NumericTuple layout_location (allow_None=False, constant=False, default=(-1, -1), instantiate=False, length=2, pickle_default_value=True, precedence=-1, readonly=False)
Location for this Sheet in an arbitrary pixel-based space in which Sheets can be laid out for visualization.
param Number spike_amplitude (allow_None=False, bounds=(0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Amplitude of spike at the moment of spiking
param List trace_coords (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
List of coord(s) of membrane potential(s) to track over time
param Number threshold_decay_rate (allow_None=False, bounds=(0, None), constant=False, default=0.01, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Dynamic threshold decay rate
param Boolean plastic (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Setting this to False tells the Sheet not to change its permanent state (e.g. any connection weights) based on incoming events.
param Integer tsettle (allow_None=False, bounds=(0, None), constant=False, default=8, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Number of times to activate the SettlingCFSheet sheet for each external input event. A counter is incremented each time an input is received from any source, and once the counter reaches tsettle, the last activation step is skipped so that there will not be any further recurrent activation. The next external (i.e., afferent or feedback) event will then start the counter over again.
param Boolean continuous_learning (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to modify the weights after every settling step. If false, waits until settling is completed before doing learning.
param Parameter strict_tsettle (allow_None=True, constant=False, default=None, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If non-None, delay sending output until activation_count reaches this value.
param Boolean apply_output_fns (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to apply the output_fn after computing an Activity matrix.
param Number row_precedence (allow_None=False, bounds=None, constant=False, default=0.5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Allows grouping of Sheets before sorting precedence is applied, e.g. for two-dimensional plots in the GUI.
param Number nominal_density (allow_None=False, bounds=None, constant=True, default=10, inclusive_bounds=(True, True), instantiate=True, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
User-specified number of processing units per 1.0 distance horizontally or vertically in Sheet coordinates. The actual number may be different because of discretization; the matrix needs to tile the plane exactly, and for that to work the density might need to be adjusted. For instance, an area of 3x2 cannot have a density of 2 in each direction. The true density may be obtained from either the xdensity or ydensity attribute (since these are identical for a Sheet).
param HookList end_of_iteration (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
List of callables to be executed at the end of each iteration.
param Boolean reset_on_new_iteration (allow_None=False, bounds=(0, 1), constant=False, default=False, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Reset activity and projection activity when new iteration starts
param Dict properties (allow_None=False, constant=False, default={}, instantiate=True, is_instance=True, pickle_default_value=True, precedence=None, readonly=False)
A dictionary of property values associated with the Sheet object. For instance, the dictionary: {‘polarity’:’ON’, ‘eye’:’Left’} could be used to indicate a left, LGN Sheet with ON-surround receptive fields.
param Number absolute_refractory (allow_None=False, bounds=(0, None), constant=False, default=1.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Absolute refractory period
param Number noise_rate (allow_None=False, bounds=(0, 1.0), constant=False, default=0.0, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Noise added to the on-going activity
param Boolean measure_maps (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
Whether to include this Sheet when measuring various maps to create SheetViews.
param Integer mask_init_time (allow_None=False, bounds=(0, None), constant=False, default=5, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Determines when a new mask is initialized in each new iteration. The mask is reset whenever new input comes in. Once the activation_count (see tsettle) reaches mask_init_time, the mask is initialized to reflect the current activity profile.
param BoundingRegionParameter nominal_bounds (allow_None=False, constant=True, default=BoundingBox(radius=0.5), instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
User-specified BoundingBox of the Sheet coordinate area covered by this Sheet. The left and right bounds–if specified–will always be observed, but the top and bottom bounds may be adjusted to ensure the density in the y direction is the same as the density in the x direction. In such a case, the top and bottom bounds are adjusted so that the center y point remains the same, and each bound is as close as possible to its specified value. The actual value of this Parameter is not adjusted, but the true bounds may be found from the ‘bounds’ attribute of this object.
param Number trace_n (allow_None=False, bounds=(1, None), constant=False, default=400, inclusive_bounds=(True, True), instantiate=False, pickle_default_value=True, precedence=None, readonly=False, time_dependent=True, time_fn=<Time Time00001>)
Number of steps to track neuron’s membrane potential
param Parameter mask (allow_None=False, constant=False, default=<SheetMask SheetMask00984>, instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
SheetMask object for computing which units need to be computed further. The object should be an instance of SheetMask, and will compute which neurons will be considered active for the purposes of further processing. The default mask effectively disables all masking, but subclasses can use this mask to implement optimizations, non-rectangular Sheet shapes, lesions, etc.
param HookList output_fns (allow_None=False, bounds=(0, None), constant=False, default=[PiecewiseLinear(init_keys=[], lower_bound=0.1, name=’PiecewiseLinear01516’, norm_value=None, upper_bound=0.65)], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
Output function(s) to apply (if apply_output_fns is true) to this Sheet’s activity.
param Boolean allow_skip_non_responding_units (allow_None=False, bounds=(0, 1), constant=False, default=True, instantiate=False, pickle_default_value=True, precedence=None, readonly=False)
If true, then units that are inactive after the response function has been called can be skipped in subsequent processing. Whether or not the units will actually be skipped depends on the implementation of learning and learning output functions.
param HookList post_initialization_weights_output_fns (allow_None=False, bounds=(0, None), constant=False, default=[], instantiate=True, pickle_default_value=True, precedence=None, readonly=False)
If not empty, weights output_fns that will replace the existing ones after an initial normalization step.
activate()[source]

For now, this is the same as the parent’s activate(), plus fixed+dynamic thresholding. Overloading was necessary to avoid self.send_output() being invoked before thresholding. This function also updates and maintains internal values such as membrane_potential, spike, etc.

activity_len()

Return the number of items that have been saved by state_push().

closest_cell_center(x, y)

Given arbitary sheet coordinates, return the sheet coordinates of the center of the closest unit.

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.

density

The sheet’s true density (i.e. the xdensity, which is equal to the ydensity for a Sheet.)

force_new_dynamic_value = <functools.partial object at 0x2b07af39d0a8>
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 0x2b07af39d1b0>
input_event(conn, data)[source]

SLISSOM-specific input_event handeling: On a new afferent input, DO NOT clear the activity matrix unless reset_on_new_iteration is True.

inspect_value = <functools.partial object at 0x2b07af39d158>
static joint_norm_fn(projlist, active_units_mask=True)

Compute norm_total for each CF in each projection from a group to be normalized jointly.

learn()

Call the learn() method on every Projection to the Sheet, and call the output functions (jointly if necessary).

matrix2sheet(float_row, float_col)

Convert a floating-point location (float_row,float_col) in matrix coordinates to its corresponding location (x,y) in sheet coordinates.

Valid for scalar or array float_row and float_col.

Inverse of sheet2matrix().

matrixidx2sheet(row, col)

Return (x,y) where x and y are the floating point coordinates of the center of the given matrix cell (row,col). If the matrix cell represents a 0.2 by 0.2 region, then the center location returned would be 0.1,0.1.

NOTE: This is NOT the strict mathematical inverse of sheet2matrixidx(), because sheet2matrixidx() discards all but the integer portion of the continuous matrix coordinate.

Valid only for scalar or array row and col.

matrixplot_trace()[source]

Matrixplot membrane potential trace of the unit designated by the trace_coords list.

message(msg, *args, **kw)

Print msg merged with args as a message.

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

n_bytes()

Estimate the memory bytes taken by this Sheet and its Projections.

Typically, this number will include the activity array and any similar arrays, plus memory taken by all incoming Projections. It will not usually include memory taken by the Python dictionary or various “housekeeping” attributes, which usually contribute only a small amount to the memory requirements. Thus this value should be considered only a rough lower bound from which memory requirements and memory usage patterns can be estimated.

Subclasses should reimplement this method if they store a significant amount of data other than in the activity array and the projections.

n_conns()

Count the total size of all incoming projections, in number of connections.

override_plasticity_state(new_plasticity_state)

Temporarily override plasticity state of medium and long term internal state.

This function should be implemented by all subclasses so that when new_plasticity_state=False, it preserves the ability of the ProjectionSheet to compute activity, i.e. to operate over a short time scale, while preventing any lasting changes to the state.

Any process that does not have any lasting state, such as those affecting only the current activity level, should not be affected by this call.

By default, calls override_plasticity_state() on the ProjectionSheet’s output_fns and all of its incoming Projections, and also enables the ‘plastic’ parameter for this ProjectionSheet. The old value of the plastic parameter is saved to an internal stack to be restored by restore_plasticity_state().

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.

plot_trace()[source]

Plot membrane potential trace of the unit designated by the trace_coords list. This plot has trace_n data points.

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.

present_input(input_activity, conn)

Provide the given input_activity to each in_projection that has a dest_port equal to the specified port, asking each one to compute its activity.

The sheet’s own activity is not calculated until activate() is called.

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.

process_current_time()

Pass the accumulated stimulation through self.output_fns and send it out on the default output port.

projections(name=None)

Return either a named input p, or a dictionary {projection_name, projection} of all the in_connections for this ProjectionSheet.

A minor convenience function for finding projections by name; the sheet’s list of in_connections usually provides simpler access to the Projections.

release_sheet_view(view_name)

Delete the dictionary entry with key entry ‘view_name’ to save memory.

row_col_sheetcoords()

Return an array of Y-coordinates corresponding to the rows of the activity matrix of the sheet, and an array of X-coordinates corresponding to the columns.

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

Generate a runnable command for creating this EventProcessor.

send_output(src_port=None, data=None)

Send some data out to all connections on the given src_port.

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 0x2b07af39d310>
set_param = <functools.partial object at 0x2b07af39d3c0>
sheet2matrix(x, y)

Convert a point (x,y) in Sheet coordinates to continuous matrix coordinates.

Returns (float_row,float_col), where float_row corresponds to y, and float_col to x.

Valid for scalar or array x and y.

Note about Bounds For a Sheet with BoundingBox(points=((-0.5,-0.5),(0.5,0.5))) and density=3, x=-0.5 corresponds to float_col=0.0 and x=0.5 corresponds to float_col=3.0. float_col=3.0 is not inside the matrix representing this Sheet, which has the three columns (0,1,2). That is, x=-0.5 is inside the BoundingBox but x=0.5 is outside. Similarly, y=0.5 is inside (at row 0) but y=-0.5 is outside (at row 3) (it’s the other way round for y because the matrix row index increases as y decreases).

sheet2matrixidx(x, y)

Convert a point (x,y) in sheet coordinates to the integer row and column index of the matrix cell in which that point falls, given a bounds and density. Returns (row,column).

Note that if coordinates along the right or bottom boundary are passed into this function, the returned matrix coordinate of the boundary will be just outside the matrix, because the right and bottom boundaries are exclusive.

Valid for scalar or array x and y.

sheetcoordinates_of_matrixidx()

Return x,y where x is a vector of sheet coordinates representing the x-center of each matrix cell, and y represents the corresponding y-center of the cell.

sheetcoords_of_idx_grid()

Return an array of x-coordinates and an array of y-coordinates corresponding to the activity matrix of the sheet.

update_unit_view(x, y, proj_name='')

Creates the list of UnitView objects for a particular unit in this CFSheet. (There is one UnitView for each Projection to this CFSheet).

Each UnitView is then added to the sheet_views of its source sheet. It returns the list of all UnitViews for the given unit.

vectorplot_trace()[source]

Plot membrane potential trace of the unit designated by the trace_coords list. This plot has trace_n data points. This method simply calls plot_trace().

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.

xdensity

The spacing between elements in an underlying matrix representation, in the x direction.

ydensity

The spacing between elements in an underlying matrix representation, in the y direction.