Package topo :: Package commands :: Module analysis
[hide private]
[frames] | no frames]

Module analysis

source code

User-level analysis commands, typically for measuring or generating SheetViews.

$Id: analysis.py 8012 2008-02-19 01:11:11Z jbednar $




Version: $Revision: 8012 $

Classes [hide private]
  Feature
Stores the parameters required for generating a map of one input feature.
  PatternPresenter
Function object for presenting PatternGenerator-created patterns.
  Subplotting
Convenience functions for handling subplots (such as colorized Activity plots).
Functions [hide private]
 
save_plotgroup(name, saver_params={}, **params)
Convenience command for saving a set of plots to disk.
source code
 
update_activity()
Make a map of neural activity available for each sheet, for use in template-based plots.
source code
 
update_connectionfields()
Add SheetViews for the weights of one unit in a CFSheet, for use in template-based plots.
source code
 
update_projections()
Add SheetViews for the weights in one CFProjection, for use in template-based plots.
source code
 
update_projectionactivity()
Add SheetViews for all of the Projections of the ProjectionSheet specified by sheet_name, for use in template-based plots.
source code
 
measure_position_pref(divisions=6, size=0.5, scale=0.3, offset=0.0, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-0.5, 0.5), y_range=(-0.5, 0.5), weighted_average=True)
Measure position preference map, using a circular Gaussian by default.
source code
 
measure_rfs(divisions=10, scale=30.0, offset=0.5, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-0.2, 0.2), y_range=(-0.2, 0.2))
Map receptive fields by reverse correlation.
source code
 
measure_rfs_noise(divisions=99, scale=0.5, offset=0.5, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-1.0, 1.0), y_range=(-1.0, 1.0))
Map receptive field on a GeneratorSheet using Gaussian noise inputs.
source code
 
measure_cog(proj_name='Afferent')
Calculate center of gravity (CoG) for each CF of each unit in each CFSheet.
source code
 
measure_rfcog(sheet_name='V1', input_sheet_name='Retina')
Calculate center of gravity (CoG) for each RF of the specified sheet.
source code
 
measure_or_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)
Measure orientation maps, using a sine grating by default.
source code
 
measure_od_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)
Measure ocular dominance maps, using a sine grating by default.
source code
 
measure_sf_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)
Measure spatial frequency maps, using a sine grating by default.
source code
 
measure_phasedisparity(num_phase=12, num_orientation=4, num_disparity=12, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)
Measure disparity maps, using sine gratings by default.
source code
 
measure_or_tuning_fullfield(num_phase=18, num_orientation=12, frequencies=[2.4], curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)
Measures orientation tuning curve of a particular unit using a full field grating stimulus.
source code
 
measure_or_tuning(num_phase=18, num_orientation=12, frequencies=[2.4], curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., display=False, size=0.5, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)
Measures orientation tuning curve of a particular unit.
source code
 
measure_size_response(num_phase=18, curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., num_sizes=10, display=False, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)
Measure receptive field size of one unit of a sheet.
source code
 
measure_contrast_response(contrasts=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], relative_orientations=[0.0, 0.523598775598, 0.785398163397, 1.57079632679], size=0.5, display=False, frequency=2.4, num_phase=18, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)
Measures contrast response curves for a particular unit.
source code
 
measure_dr_pref(num_phase=12, num_direction=6, num_speeds=4, max_speed=0.0833333333333, frequencies=[2.4], scale=0.2, offset=0.0, display=False, weighted_average=True, apply_output_fn=False, duration=0.175, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...) source code
 
decode_feature(sheet, preference_map='OrientationPreference', axis_bounds=(0.0, 1.0), cyclic=True, weighted_average=True)
Estimate the value of a feature from the current activity pattern on a sheet.
source code
 
measure_corner_or_pref(divisions=20, num_orientation=8, scale=1.0, offset=0.0, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-1.4, 1.4), y_range=(-1.4, 1.4), weighted_average=True)
Measure position preference map, using a corner formed by two gaussians by default.
source code
Variables [hide private]
  coordinate = (0, 0)
  sheet_name = ''
  input_sheet_name = ''
  proj_coords = [(0, 0)]
  proj_name = ''
  gaussian_corner = Composite(bounds=BoundingBox(radius=0.5), ge...
  pg = TemplatePlotGroup(auto_refresh=False, category='Preferenc...
Function Details [hide private]

save_plotgroup(name, saver_params={}, **params)

source code 

Convenience command for saving a set of plots to disk. Examples:

save_plotgroup("Activity") save_plotgroup("Orientation Preference") save_plotgroup("Projection",projection=topo.sim['V1'].projections('Afferent'))

Some plotgroups accept optional parameters, which can be passed like projection above.

(To pass an optional parameter to the PlotFileSaver itself, the saver_params dictionary can be used.)

update_activity()

source code 

Make a map of neural activity available for each sheet, for use in template-based plots.

This command simply asks each sheet for a copy of its activity matrix, and then makes it available for plotting. Of course, for some sheets providing this information may be non-trivial, e.g. if they need to average over recent spiking activity.

measure_position_pref(divisions=6, size=0.5, scale=0.3, offset=0.0, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-0.5, 0.5), y_range=(-0.5, 0.5), weighted_average=True)

source code 

Measure position preference map, using a circular Gaussian by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the divisions parameter. The particular pattern used is determined by the size, scale, offset, and pattern_presenter arguments.

measure_rfs(divisions=10, scale=30.0, offset=0.5, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-0.2, 0.2), y_range=(-0.2, 0.2))

source code 

Map receptive fields by reverse correlation.

Presents a large collection of input patterns, typically small Gaussians, keeping track of which units in the specified input_sheet were active when each unit in other Sheets in the simulation was active. This data can then be used to plot receptive fields for each unit. Note that the results are true receptive fields, not the connection fields usually presented in lieu of receptive fields, because they take all circuitry in between the input and the target unit into account.

Note that it is crucial to set the scale parameter properly when using units with a hard activation threshold (as opposed to a smooth sigmoid), because the input pattern used here may not be a very effective way to drive the unit to activate. The value should be set high enough that the target units activate at least some of the time there is a pattern on the input.

measure_cog(proj_name='Afferent')

source code 

Calculate center of gravity (CoG) for each CF of each unit in each CFSheet.

Unlike measure_position_pref and other measure commands, this one does not work by collating the responses to a set of input patterns. Instead, the CoG is calculated directly from each set of afferent weights. The CoG value thus is an indirect estimate of what patterns the neuron will prefer, but is not limited by the finite number of test patterns as the other measure commands are.

At present, the name of the projection to use must be specified in the argument to this function, and a model using any other name must specify that explicitly when this function is called.

measure_rfcog(sheet_name='V1', input_sheet_name='Retina')

source code 

Calculate center of gravity (CoG) for each RF of the specified sheet.

The RFs are assumed to have been measured previously using measure_rfs(). The CoG is then calculated as in measure_cog().

At present, the names of the input and target sheets to use must be specified in the arguments to this function, and a model using any other names must specify those explicitly when this function is called.

measure_or_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)

source code 

Measure orientation maps, using a sine grating by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the num_phase, num_orientation, and frequencies parameters. The particular pattern used is determined by the pattern_presenter argument, which defaults to a sine grating presented for a short duration. By convention, most Topographica example files are designed to have a suitable activity pattern computed by that time, but the duration will need to be changed for other models that do not follow that convention.

measure_od_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)

source code 

Measure ocular dominance maps, using a sine grating by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the num_phase, num_orientation, and frequencies parameters. The particular pattern used is determined by the pattern_presenter argument, which defaults to a sine grating presented for a short duration. By convention, most Topographica example files are designed to have a suitable activity pattern computed by that time, but the duration will need to be changed for other models that do not follow that convention.

measure_sf_pref(num_phase=18, num_orientation=4, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)

source code 

Measure spatial frequency maps, using a sine grating by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the num_phase, num_orientation, and frequencies parameters. The particular pattern used is determined by the pattern_presenter argument, which defaults to a sine grating presented for a short duration. By convention, most Topographica example files are designed to have a suitable activity pattern computed by that time, but the duration will need to be changed for other models that do not follow that convention.

measure_phasedisparity(num_phase=12, num_orientation=4, num_disparity=12, frequencies=[2.4], scale=0.3, offset=0.0, display=False, weighted_average=True, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)

source code 

Measure disparity maps, using sine gratings by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the num_phase, num_orientation, num_disparity, and frequencies parameters. The particular pattern used is determined by the

pattern_presenter argument, which defaults to a sine grating presented for a short duration. By convention, most Topographica example files are designed to have a suitable activity pattern computed by that time, but the duration will need to be changed for other models that do not follow that convention.

measure_or_tuning_fullfield(num_phase=18, num_orientation=12, frequencies=[2.4], curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name...)

source code 
Measures orientation tuning curve of a particular unit using a full field grating stimulus. michelson_contrast can be replaced by another variable(s) eg. scale, weber_contrast or any other contrast definition, provided it is defined in PatternPresenter.

measure_or_tuning(num_phase=18, num_orientation=12, frequencies=[2.4], curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., display=False, size=0.5, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)

source code 
Measures orientation tuning curve of a particular unit. Uses a circular sine grating patch as the stimulus on the retina. If the network contains an LGN layer then weber_contrast can be used as the contrast_parameter. If there is no LGN then scale (offset=0.0) can be used to define the contrast. Other relevant contrast definitions can also be used provided they are defined in PatternPresenter.(The curve_label should also be changed to reflect new units)

measure_size_response(num_phase=18, curve_parameters=[{'contrast': 30}, {'contrast': 60}, {'contrast': 80}, {'contr..., num_sizes=10, display=False, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)

source code 

Measure receptive field size of one unit of a sheet.

Uses an expanding circular sine grating stimulus at the preferred orientation and retinal position of the specified unit. Orientation and position preference must be calulated before measuring size response.

The curve can be plotted at various different values of the contrast of the stimulus. If the network contains an LGN layer then weber_contrast can be used as the contrast_parameter. If there is no LGN then scale (offset=0.0) can be used to define the contrast. Other relevant contrast definitions can also be used provided they are defined in PatternPresenter. (The curve_label should also be changed to reflect new units)

measure_contrast_response(contrasts=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100], relative_orientations=[0.0, 0.523598775598, 0.785398163397, 1.57079632679], size=0.5, display=False, frequency=2.4, num_phase=18, pattern_presenter=PatternPresenter(contrast_parameter='weber_contrast', name=Non...)

source code 

Measures contrast response curves for a particular unit.

Uses a circular sine grating patch as the stimulus on the retina. If the network contains an LGN layer then weber_contrast can be used as the contrast_parameter. If there is no LGN then scale (offset=0.0) can be used to define the contrast. Other relevant contrast definitions can also be used provided they are defined in PatternPresenter (The curve_label should also be changed to reflect new units)

The stimulus is presented at the preferred orientation and retinal position of the unit.Orientation preference and position preference must be measured before measuring the contrast response.

decode_feature(sheet, preference_map='OrientationPreference', axis_bounds=(0.0, 1.0), cyclic=True, weighted_average=True)

source code 

Estimate the value of a feature from the current activity pattern on a sheet.

The specified preference_map should be measured before this function is called.

If weighted_average is False, the feature value returned is the value of the preference_map at the maximally active location.

If weighted_average is True, the feature value is estimated by weighting the preference_map by the current activity level, and averaging the result across all units in the sheet. The axis_bounds specify the allowable range of the feature values in the preference_map. If cyclic is true, a vector average is used; otherwise an arithmetic weighted average is used.

For instance, if preference_map is OrientationPreference (a cyclic quantity), then the result will be the vector average of the activated orientations. For an orientation map this value should be an estimate of the orientation present on the input.

measure_corner_or_pref(divisions=20, num_orientation=8, scale=1.0, offset=0.0, display=False, pattern_presenter=PatternPresenter(contrast_parameter='michelson_contrast', name..., x_range=(-1.4, 1.4), y_range=(-1.4, 1.4), weighted_average=True)

source code 

Measure position preference map, using a corner formed by two gaussians by default.

Measures maps by collating the responses to a set of input patterns controlled by some parameters. The parameter ranges and number of input patterns in each range are determined by the divisions parameter. The particular pattern used is determined by the size, scale, offset, and pattern_presenter arguments.


Variables Details [hide private]

gaussian_corner

Value:
Composite(bounds=BoundingBox(radius=0.5), generators=[Gaussian(aspect_ratio=7, bou\
nds=BoundingBox(radius=0.5), mask=None, name='Gaussian00146', offset=0.0, orientat\
ion=0, output_fn=IdentityOF(name='IdentityOF00147', norm_value=None, print_level=1\
00), position=[0.29999999999999999, 0.0], print_level=100, scale=1.0, size=0.05999\
9999999999998, x=0.29999999999999999, xdensity=10, y=0.0, ydensity=10), Gaussian(a\
spect_ratio=7, bounds=BoundingBox(radius=0.5), mask=None, name='Gaussian00149', of\
fset=0.0, orientation=1.5707963267948966, output_fn=IdentityOF(name='IdentityOF001\
50', norm_value=None, print_level=100), position=[0.0, 0.29999999999999999], print\
...

pg

Value:
TemplatePlotGroup(auto_refresh=False, category='Preference Maps', desired_maximum_\
plot_height=0, doc='Measure orientation prefference for corner stimuly [or general\
ly any more complex stimuly that cannot be represented as fullfield pattern].', en\
force_minimum_plot_height=True, integer_scaling=False, name='Corner OR Preference'\
, normalize=True, plot_command='', plot_immediately=False, prerequisites=[], print\
_level=100, sheet_coords=False, update_command='measure_corner_or_pref(); topograp\
hic_grid()')