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

Module analysis

source code

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

Most of this file consists of commands for creating SheetViews, paired with a template for how to construct plots from these SheetViews.

For instance, the implementation of Activity plots consists of the update_activity() command plus the Activity PlotGroupTemplate. The update_activity() command reads the activity array of each Sheet and makes a corresponding SheetView to put in the Sheet's sheet_views dictionary, while the Activity PlotGroupTemplate specifies which SheetViews should be plotted in which combination. See the help for PlotGroupTemplate for more information.

Some of the commands are ordinary Python functions, but the rest are ParameterizedFunctions, which act like Python functions but support Parameters with defaults, bounds, inheritance, etc. These commands are usually grouped together using inheritance so that they share a set of parameters and some code, and only the bits that are specific to that particular plot or analysis appear below. See the superclasses for the rest of the parameters and code.

$Id: analysis.py 11316 2010-07-27 17:52:53Z ceball $


Version: $Revision: 11316 $

Classes [hide private]
  ParameterizedFunction
Acts like a Python function, but with arguments that are Parameters.
  UnitMeasurementCommand
A callable Parameterized command for measuring or plotting specified units from a Sheet.
  ProjectionSheetMeasurementCommand
A callable Parameterized command for measuring or plotting a specified Sheet.
  SinusoidalMeasureResponseCommand
Parameterized command for presenting sine gratings and measuring responses.
  PositionMeasurementCommand
Parameterized command for measuring topographic position.
  SingleInputResponseCommand
A callable Parameterized command for measuring the response to input on a specified Sheet.
  save_plotgroup
Convenience command for saving a set of plots to disk.
  update_connectionfields
A callable Parameterized command for measuring or plotting a unit from a Projection.
  update_projection
A callable Parameterized command for measuring or plotting units from a Projection.
  update_projectionactivity
Add SheetViews for all of the Projections of the ProjectionSheet specified by the sheet parameter, for use in template-based plots.
  measure_rfs
Map receptive fields by reverse correlation.
  measure_sine_pref
Measure preferences for sine gratings in various combinations.
  measure_or_pref
Measure an orientation preference map by collating the response to patterns.
  measure_od_pref
Measure an ocular dominance preference map by collating the response to patterns.
  measure_phasedisparity
Measure a phase disparity preference map by collating the response to patterns.
  measure_dr_pref
Measure a direction preference map by collating the response to patterns.
  measure_hue_pref
Measure a hue preference map by collating the response to patterns.
  measure_corner_or_pref
Measure a corner preference map by collating the response to patterns.
  measure_corner_angle_pref
Generate the preference map for angle shapes, by collating the response to patterns.
  measure_frequency_pref
Measure a frequency preference and selectivity map
Functions [hide private]
 
array(sequence, typecode=None, copy=1, savespace=0, dtype=None)
 
create_plotgroup(template_plot_type='bitmap', **params)
Create a new PlotGroup and add it to the plotgroups list.
source code
 
_equivalent_for_plotgroup_update(p1, p2)
Helper function for save_plotgroup.
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
 
update_activity()
Make a map of neural activity available for each sheet, for use in template-based plots.
source code
 
update_rgb_activities()
Make available Red, Green, and Blue activity matrices for all appropriate sheets.
source code
 
compute_orientation_from_direction(current_values)
Return the orientation corresponding to the given direction.
source code
Variables [hide private]
  pi = 3.14159265359
  maximum = <ufunc 'maximum'>
  plotgroups = [('Activity', TemplatePlotGroup(auto_refresh=True...
  gaussian_corner = Composite(bounds=BoundingBox(radius=0.5), ge...
  pg = TemplatePlotGroup(auto_refresh=False, category='Preferenc...
  __package__ = 'topo.command'
  k = 'Image'
Function Details [hide private]

create_plotgroup(template_plot_type='bitmap', **params)

source code 

Create a new PlotGroup and add it to the plotgroups list.

Convenience function to make it simpler to use the name of the PlotGroup as the key in the plotgroups list.

template_plot_type: Whether the plots are bitmap images or curves ('curve').

_equivalent_for_plotgroup_update(p1, p2)

source code 

Helper function for save_plotgroup.

Comparison operator for deciding whether make_plots(update==False) is safe for one plotgroup if the other has already been updated.

Treats plotgroups as the same if the specified list of attributes (if present) match in both plotgroups.

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.

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.

compute_orientation_from_direction(current_values)

source code 

Return the orientation corresponding to the given direction.

Wraps the value to be in the range [0,pi), and rounds it slightly so that wrapped values are precisely the same (to avoid biases caused by vector averaging with keep_peak=True).

Note that in very rare cases (1 in 10^-13?), rounding could lead to different values for a wrapped quantity, and thus give a heavily biased orientation map. In that case, just choose a different number of directions to test, to avoid that floating point boundary.


Variables Details [hide private]

plotgroups

Value:
[('Activity', TemplatePlotGroup(auto_refresh=True, category='Basic', desired_maxim\
um_plot_height=0, doc='Plot the activity for all Sheets.', enforce_minimum_plot_he\
ight=True, integer_scaling=False, name='Activity', normalize='None', plot_hooks=[]\
, plot_immediately=True, pre_plot_hooks=[<function update_activity at 0xb32341c>],\
 prerequisites=[], print_level=100, sheet_coords=False)), ('RGB', TemplatePlotGrou\
p(auto_refresh=True, category='Other', desired_maximum_plot_height=0, doc='Combine\
 and plot the red, green, and blue activity for all appropriate Sheets.', enforce_\
minimum_plot_height=True, integer_scaling=False, name='RGB', normalize='None', plo\
...

gaussian_corner

Value:
Composite(bounds=BoundingBox(radius=0.5), generators=[Gaussian(aspect_ratio=7, bou\
nds=BoundingBox(radius=0.5), mask=None, mask_shape=None, name='Gaussian00088', off\
set=0.0, orientation=0, output_fns=[], position=[0.29999999999999999, 0.0], print_\
level=100, scale=1.0, size=0.059999999999999998, x=0.29999999999999999, xdensity=1\
0, y=0.0, ydensity=10), Gaussian(aspect_ratio=7, bounds=BoundingBox(radius=0.5), m\
ask=None, mask_shape=None, name='Gaussian00089', offset=0.0, orientation=1.5707963\
267948966, output_fns=[], position=[0.0, 0.29999999999999999], print_level=100, sc\
ale=1.0, size=0.059999999999999998, x=0.0, xdensity=10, y=0.29999999999999999, yde\
...

pg

Value:
TemplatePlotGroup(auto_refresh=False, category='Preference Maps', desired_maximum_\
plot_height=0, doc='Measure best frequency preference and selectivity for auditory\
 neurons.', enforce_minimum_plot_height=True, integer_scaling=False, name='Frequen\
cy Preference and Selectivity', normalize='Individually', plot_hooks=[], plot_imme\
diately=False, pre_plot_hooks=[measure_frequency_pref(apply_output_fns=None, displ\
ay=True, divisions=100, duration=None, generator_sheets=[], name='measure_frequenc\
y_pref00109', offset=0.0, pattern_presenter=PatternPresenter(apply_output_fns=True\
, contrast_parameter='michelson_contrast', divisions=None, duration=1.0, generator\
...