def __call__(self,fullmatrix,simple_sheet_name=None,complex_sheet_name=None,bins=frange(0,2.0,0.1,inclusive=True),**params): p=ParamOverrides(self,params) from topo.analysis.vision import complexity if (topo.sim.objects().has_key(simple_sheet_name) and topo.sim.objects().has_key(complex_sheet_name)): v1s = complexity(fullmatrix[topo.sim[simple_sheet_name]]).flatten() v1c = complexity(fullmatrix[topo.sim[complex_sheet_name]]).flatten() #double the number of complex cells to reflect large width of layer 2/3 v1c = numpy.concatenate((array(v1c),array(v1c)),axis=1) pylab.figure() n = pylab.subplot(311) pylab.hist(v1s,bins) pylab.axis([0,2.0,0,4100]) n.yaxis.set_major_locator(matplotlib.ticker.MaxNLocator(3)) n = pylab.subplot(312) pylab.hist(v1c,bins) pylab.axis([0,2.0,0,4100]) n.yaxis.set_major_locator(matplotlib.ticker.MaxNLocator(3)) n = pylab.subplot(313) pylab.hist(numpy.concatenate((array(v1s),array(v1c)),axis=1),bins) pylab.axis([0,2.0,0,4100]) n.yaxis.set_major_locator(matplotlib.ticker.MaxNLocator(3)) self._generate_figure(p)
def analyze_modulation_ratio(full_matrix, sheets_to_plot=[], sheets_to_scatter_plot=[], filename=None): """ Computes modulation ratio for each neuron, to distinguish complex from simple cells. Uses full_matrix data obtained from measure_or_pref(). Plots phase preference scatter plot for sheets specified in sheets_to_scatter_plot """ import topo measured_sheets = [s for s in topo.sim.objects(CFSheet).values() if hasattr(s,'measure_maps') and s.measure_maps] for sheet in measured_sheets: from topo.analysis.vision import complexity mr = array(complexity(full_matrix[sheet])) sheet.sheet_views['ModulationRatio']=SheetView((mr,sheet.bounds), sheet.name, sheet.precedence, topo.sim.time(), sheet.row_precedence) if len(sheets_to_plot) > 0: plot_hist_from_view('ModulationRatio', (0,2,0.1), xlabel='Modulation Ratio', sheets_to_plot=sheets_to_plot, filename='Hist'+filename if filename != None else None) if len(sheets_to_scatter_plot) > 0: for sheet in sheets_to_scatter_plot: scatter_plot_phase_preference_simple_cell(sheet,diameter=0.24999, filename='Simple_cells_scatter_plot_'+sheet if filename != None else None)