# Avoid error if no simple sheet exists try: phase_preference_scatter_plot(simple_sheet_name,diameter=0.24999) except AttributeError: print "Skipping phase preference scatter plot; could not analyze region %s." \ % simple_sheet_name class measure_and_analyze_complexity(measure_sine_pref): """Macro for measuring orientation preference and then analyzing its complexity.""" def __call__(self,**params): fm = super(measure_and_analyze_complexity,self).__call__(**params) #analyze_complexity(fm,simple_sheet_name="V1Simple",complex_sheet_name="V1Complex",filename="ModulationRatio") return fm pg= create_plotgroup(name='Orientation Preference and Complexity',category="Preference Maps", doc='Measure preference for sine grating orientation.', pre_plot_hooks=[measure_and_analyze_complexity.instance( preference_fn=DSF_WeightedAverage( value_scale=(0., 1./pi),selectivity_scale=(0.,17.0)))]) pg.add_plot('Orientation Preference',[('Hue','OrientationPreference')]) pg.add_plot('Orientation Preference&Selectivity',[('Hue','OrientationPreference'), ('Confidence','OrientationSelectivity')]) pg.add_plot('Orientation Selectivity',[('Strength','OrientationSelectivity')]) pg.add_plot('Modulation Ratio',[('Strength','ComplexSelectivity')]) pg.add_plot('Phase Preference',[('Hue','PhasePreference')]) pg.add_static_image('Color Key','command/or_key_white_vert_small.png') __all__ = [ "measure_and_analyze_complexity", "complexity", "compute_ACDC_orientation_tuning_curves",
% simple_sheet_name class measure_and_analyze_complexity(measure_sine_pref): """Macro for measuring orientation preference and then analyzing its complexity.""" def __call__(self, **params): fm = super(measure_and_analyze_complexity, self).__call__(**params) #analyze_complexity(fm,simple_sheet_name="V1Simple",complex_sheet_name="V1Complex",filename="ModulationRatio") return fm pg = create_plotgroup( name='Orientation Preference and Complexity', category="Preference Maps", doc='Measure preference for sine grating orientation.', pre_plot_hooks=[ measure_and_analyze_complexity.instance( preference_fn=DSF_WeightedAverage(value_scale=(0., 1. / pi), selectivity_scale=(0., 17.0))) ]) pg.add_plot('Orientation Preference', [('Hue', 'OrientationPreference')]) pg.add_plot('Orientation Preference&Selectivity', [('Hue', 'OrientationPreference'), ('Confidence', 'OrientationSelectivity')]) pg.add_plot('Orientation Selectivity', [('Strength', 'OrientationSelectivity')]) pg.add_plot('Modulation Ratio', [('Strength', 'ComplexSelectivity')]) pg.add_plot('Phase Preference', [('Hue', 'PhasePreference')]) pg.add_static_image('Color Key', 'command/or_key_white_vert_small.png')
# Avoid error if no simple sheet exists try: phase_preference_scatter_plot(simple_sheet_name,diameter=0.24999) except AttributeError: print "Skipping phase preference scatter plot; could not analyze region %s." \ % simple_sheet_name class measure_and_analyze_complexity(measure_sine_pref): """Macro for measuring orientation preference and then analyzing its complexity.""" def __call__(self,**params): fm = super(measure_and_analyze_complexity,self).__call__(**params) #from topo.command.analysis import measure_or_pref #fm = measure_or_pref() analyze_complexity(fm,simple_sheet_name="V1Simple",complex_sheet_name="V1Complex",filename="ModulationRatio") pg= create_plotgroup(name='Orientation Preference and Complexity',category="Preference Maps", doc='Measure preference for sine grating orientation.', pre_plot_hooks=[measure_and_analyze_complexity.instance()]) pg.add_plot('Orientation Preference',[('Hue','OrientationPreference')]) pg.add_plot('Orientation Preference&Selectivity',[('Hue','OrientationPreference'), ('Confidence','OrientationSelectivity')]) pg.add_plot('Orientation Selectivity',[('Strength','OrientationSelectivity')]) pg.add_plot('Modulation Ratio',[('Strength','ComplexSelectivity')]) pg.add_plot('Phase Preference',[('Hue','PhasePreference')]) pg.add_static_image('Color Key','command/or_key_white_vert_small.png')
class measure_position_pref(PositionMeasurementCommand): """Measure a position preference map by collating the response to patterns.""" scale = param.Number(default=0.3) def _feature_list(self,p): width =1.0*p.x_range[1]-p.x_range[0] height=1.0*p.y_range[1]-p.y_range[0] return [Feature(name="x",range=p.x_range,step=width/p.divisions,preference_fn=self.preference_fn), Feature(name="y",range=p.y_range,step=height/p.divisions,preference_fn=self.preference_fn)] from topo.misc.distribution import DSF_WeightedAverage pg= create_plotgroup(name='Position Preference',category="Preference Maps", doc='Measure preference for the X and Y position of a Gaussian.', pre_plot_hooks=[measure_position_pref.instance( preference_fn=DSF_WeightedAverage( selectivity_scale=(0.,17.) ))], plot_hooks=[topographic_grid.instance()], normalize='Individually') pg.add_plot('X Preference',[('Strength','XPreference')]) pg.add_plot('Y Preference',[('Strength','YPreference')]) pg.add_plot('Position Preference',[('Red','XPreference'), ('Green','YPreference')]) class measure_cog(ParameterizedFunction): """ Calculate center of gravity (CoG) for each CF of each unit in each CFSheet. Unlike measure_position_pref and other measure commands, this one
#print "Circular Variance" analyze_circular_variance(fm, sheets_to_plot=sheets, filename="CircularVariance" if plot_into_file else None) #print "Orientation Bandwidth" analyze_orientation_bandwidth(fm, sheets_to_plot=sheets, filename="Bandwidth" if plot_into_file else None) # plot joint statistics, such as corelations, ... #print "Plotting correlations" plot_correlation_from_view('ModulationRatio', 'Modulation Ratio', (0,2,0.04), 'CircularVariance', 'Circular Variance', (0,1,0.02), sheets_to_plot=sheets,filename='Correlation_ModulationRatio_CircularVariance'if plot_into_file else None) plot_correlation_from_view('ModulationRatio', 'Modulation Ratio', (0,2,0.04), 'OrientationBandwidth', 'Orientation Bandwidth [rad]', (0,3.2,0.04), sheets_to_plot=sheets,filename='Correlation_ModulationRatio_OrientationBandwith'if plot_into_file else None) plot_correlation_from_view('OrientationBandwidth','Orientation Bandwidth [rad]', (0,3.2,0.04), 'CircularVariance', 'Circular Variance', (0,1,0.02), sheets_to_plot=sheets,filename='Correlation_OrientationBandwidth_CircularVariance'if plot_into_file else None) pg= create_plotgroup(name='Orientation Preference, Modulation Ratio, Circular Variance and Orientation Bandwidth',category="Preference Maps", doc='Measure preference for sine grating orientation.', pre_plot_hooks=[measure_and_analyze_mr_cv_ob]) pg.add_plot('Orientation Preference',[('Hue','OrientationPreference')]) pg.add_plot('Orientation Preference&Selectivity',[('Hue','OrientationPreference'), ('Confidence','OrientationSelectivity')]) pg.add_plot('Orientation Selectivity',[('Strength','OrientationSelectivity')]) pg.add_plot('Modulation Ratio',[('Strength','ModulationRatio')]) pg.add_plot('Phase Preference',[('Hue','PhasePreference')]) pg.add_plot('Circular Variance',[('Strength','CircularVariance')]) pg.add_plot('Orientation Bandwidth',[('Strength','OrientationBandwidth')]) pg.add_static_image('Color Key','topo/command/or_key_white_vert_small.png')