def perform_analysis_and_visualization(data_store): if True: analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() #find neuron with preference closet to 0 NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') l4_exc_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Exc_L4') l4_exc = analog_ids[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].get_value_by_id(analog_ids),l4_exc_phase[0].get_value_by_id(analog_ids))])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L4') l4_inh_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Inh_L4') l4_inh = analog_ids_inh[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_inh_or[0].get_value_by_id(analog_ids_inh),l4_inh_phase[0].get_value_by_id(analog_ids_inh))])] l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] print "Prefered orientation of plotted exc neurons:" print 'index ' + str(l4_exc) print "Prefered phase of plotted exc neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) print "Prefered orientation of plotted inh neurons:" print l4_inh_phase[0].get_value_by_id(l4_inh) print 'index ' + str(l4_inh) print "Prefered phase of plotted inh neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) #dsv = param_filter_query(data_store,sheet_name='V1_Exc_L4') #TrialAveragedFiringRate(param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],st_name="FullfieldDriftingSinusoidalGrating"),ParameterSet({})).analyse() dsv = param_filter_query(data_store,st_name=['InternalStimulus']) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (28,12)},plot_file_name='SSExcAnalog.png').plot() RetinalInputMovie(dsv, ParameterSet({}), fig_param={'dpi' : 100,'figsize': (28,12)},plot_file_name='video').plot()
def perform_analysis(self): for sheet in self.datastore.sheets(): # Load up spike trains for the right sheet and the corresponding stimuli, and # transform spike trains into psth dsv = select_result_sheet_query(self.datastore,sheet) assert equal_ads_except(dsv,['stimulus_id']) assert ads_with_equal_stimulus_type(dsv) assert equal_stimulus_type(dsv) psths = [psth(seg.spiketrains,self.parameters.bin_length) for seg in dsv.get_segments()] st = [StimulusID(s) for s in dsv.get_stimuli()] # average across trials psths,stids = colapse(psths,st,parameter_list=['trial'],func=neo_mean,allow_non_identical_stimuli=True) # retrieve the computed orientation preferences pnvs = self.datastore.get_analysis_result(identifier='PerNeuronValue',sheet_name=sheet,value_name='orientation preference') if len(pnvs) != 1: logger.error('ERROR: Expected only one PerNeuronValue per sheet with value_name \'orientation preference\' in datastore, got: ' + str(len(pnvs))) return None else: or_pref = pnvs[0] # find closest orientation of grating to a given orientation preference of a neuron # first find all the different presented stimuli: ps = {} for s in st: ps[StimulusID(s).params['orientation']] = True ps = ps.keys() # now find the closest presented orientations closest_presented_orientation = [] for i in xrange(0,len(or_pref.values)): circ_d = 100000 idx = 0 for j in xrange(0,len(ps)): if circ_d > circular_dist(or_pref.values[i],ps[j],numpy.pi): circ_d = circular_dist(or_pref.values[i],ps[j],numpy.pi) idx = j closest_presented_orientation.append(ps[idx]) closest_presented_orientation = numpy.array(closest_presented_orientation) # colapse along orientation - we will calculate MR for each parameter combination other than orientation d = colapse_to_dictionary(psths,stids,"orientation") for (st,vl) in d.items(): # here we will store the modulation ratios, one per each neuron modulation_ratio = numpy.zeros((numpy.shape(psths[0])[1],)) frequency = StimulusID(st).params['temporal_frequency'] * StimulusID(st).units['temporal_frequency'] for (orr,ppsth) in zip(vl[0],vl[1]): for j in numpy.nonzero(orr == closest_presented_orientation)[0]: modulation_ratio[j] = self.calculate_MR(ppsth[:,j],frequency) self.datastore.full_datastore.add_analysis_result(PerNeuronValue(modulation_ratio,qt.dimensionless,value_name = 'Modulation ratio',sheet_name=sheet,tags=self.tags,period=None,analysis_algorithm=self.__class__.__name__,stimulus_id=str(st))) import pylab pylab.figure() pylab.hist(modulation_ratio)
def __init__(self, network, source, target, parameters,name): MozaikComponent.__init__(self,network,parameters) self.name = name self.source = source self.target = target weights = [] for (i,neuron1) in enumerate(self.target.pop.all()): for (j,neuron2) in enumerate(self.source.pop.all()): or_dist = circular_dist(self.target.get_neuron_annotation(i,'LGNAfferentOrientation'),self.source.get_neuron_annotation(j,'LGNAfferentOrientation'),numpy.pi) / (numpy.pi/2) if self.parameters.specific_arborization.target_synapses == 'excitatory': phase_dist = circular_dist(self.target.get_neuron_annotation(i,'LGNAfferentPhase'),self.source.get_neuron_annotation(j,'LGNAfferentPhase'),2*numpy.pi) / numpy.pi elif self.parameters.specific_arborization.target_synapses == 'inhibitory': phase_dist = (numpy.pi - circular_dist(self.target.get_neuron_annotation(i,'LGNAfferentPhase'),self.source.get_neuron_annotation(j,'LGNAfferentPhase'),2*numpy.pi)) / numpy.pi else: logger.error('Unknown type of synapse!') return or_gauss = normal_function(or_dist,mean=0,sigma=self.parameters.or_sigma) phase_gauss = normal_function(phase_dist,mean=0,sigma=self.parameters.or_sigma) w = phase_gauss*or_gauss*or_gauss weights.append((j,i,w,self.parameters.propagation_constant)) we = numpy.zeros((len(self.source.pop),len(self.target.pop))) pnv_source = [] pnv_target = [] for (i,neuron1) in enumerate(self.target.pop.all()): pnv_target.append(self.target.get_neuron_annotation(i,'LGNAfferentOrientation')) for (i,neuron1) in enumerate(self.source.pop.all()): pnv_source.append(self.source.get_neuron_annotation(i,'LGNAfferentOrientation')) for (j,i,w,xsj) in weights: we[j,i] = w (angle,mag) = circ_mean(numpy.array([numpy.array(pnv_target).T for i in xrange(0,numpy.shape(we)[0])]),weights=numpy.array(we),low=0,high=numpy.pi,axis=1) if self.parameters.probabilistic: SpecificProbabilisticArborization(network, self.source, self.target, weights,self.parameters.specific_arborization,self.name).connect() else: SpecificArborization(network, self.source, self.target, weights,self.parameters.specific_arborization,self.name).connect()
def pick_close_to_annotation(self): picked = [] # z = self.sheet.pop.all_cells.astype(int) if isinstance(self.sheet.pop.all_cells, list): if hasattr(self.sheet.pop.all_cells[0], 'id'): z = numpy.asarray([idm.id for idm in self.sheet.pop.all_cells ]) # for IDMixin else: z = numpy.asarray(self.sheet.pop.all_cells) else: z = self.sheet.pop.all_cells.astype(int) vals = [ self.sheet.get_neuron_annotation(i, self.parameters.annotation) for i in range(0, len(z)) ] if self.parameters.period != 0: picked = numpy.array([ i for i in range(0, len(z)) if abs(vals[i] - self.parameters.value) < self.parameters.distance ]) else: picked = numpy.array([ i for i in range(0, len(z)) if circular_dist(vals[i], self.parameters.value, self. parameters.period) < self.parameters.distance ]) return picked
def generate_idd_list_of_neurons(self): picked = [] z = self.sheet.pop.all_cells.astype(int) vals = [self.sheet.get_neuron_annotation(i,self.parameters.annotation) for i in xrange(0,len(z))] if self.parameters.period != 0: pikced = [i for i in xrange(0,len(z)) if abs(vals[i]-self.parameters.value) < self.parameters.distance] else: pikced = [i for i in xrange(0,len(z)) if circular_dist(vals[i],self.parameters.value,self.parameters.period) < self.parameters.distance] return z[mozaik.rng.shuffle(picked)[:self.parameters.num_of_cells]]
def pick_close_to_annotation(self): picked = [] z = self.sheet.pop.all_cells.astype(int) vals = [self.sheet.get_neuron_annotation(i,self.parameters.annotation) for i in xrange(0,len(z))] if self.parameters.period != 0: picked = numpy.array([i for i in xrange(0,len(z)) if abs(vals[i]-self.parameters.value) < self.parameters.distance]) else: picked = numpy.array([i for i in xrange(0,len(z)) if circular_dist(vals[i],self.parameters.value,self.parameters.period) < self.parameters.distance]) return picked
def test_stimulating_function(sheet, coor_x, coor_y, current_update_interval, parameters): z = sheet.pop.all_cells.astype(int) vals = numpy.array([ sheet.get_neuron_annotation(i, 'LGNAfferentOrientation') for i in xrange(0, len(z)) ]) mean_orientations = [] px, py = sheet.vf_2_cs(sheet.pop.positions[0], sheet.pop.positions[1]) pylab.subplot(151) pylab.gca().set_aspect('equal') pylab.title('Orientatin preference (neurons)') pylab.scatter(px, py, c=vals / numpy.pi, cmap='hsv') pylab.hold(True) #pylab.scatter(coor_x.flatten(),coor_y.flatten(),c='k',cmap='hsv') ors = scipy.interpolate.griddata(zip(px, py), vals, (coor_x, coor_y), method='nearest') pylab.subplot(152) pylab.title('Orientatin preference (stimulators)') pylab.gca().set_aspect('equal') pylab.scatter(coor_x.flatten(), coor_y.flatten(), c=ors.flatten(), cmap='hsv') signals = numpy.zeros((numpy.shape(coor_x)[0], numpy.shape(coor_x)[1], int(parameters.duration / current_update_interval))) for i in xrange(0, numpy.shape(coor_x)[0]): for j in xrange(0, numpy.shape(coor_x)[0]): signals[i, j, int( numpy.floor(parameters.onset_time / current_update_interval) ):int( numpy.floor(parameters.offset_time / current_update_interval) )] = parameters.scale.value * numpy.exp(-numpy.power( circular_dist(parameters.orientation.value, ors[i][j], numpy.pi), 2) / parameters.sharpness) pylab.subplot(153) pylab.gca().set_aspect('equal') pylab.title('Activation magnitude (stimulators)') pylab.scatter(coor_x.flatten(), coor_y.flatten(), c=numpy.squeeze(numpy.mean(signals, axis=2)).flatten(), cmap='gray') pylab.title(str(parameters.orientation.value)) #pylab.colorbar() return numpy.array(signals), parameters.scale.value
def subplot(self, subplotspec): plots = {} gs = gridspec.GridSpecFromSubplotSpec(1,2, subplot_spec=subplotspec,hspace=1.0, wspace=1.0) var_gr = 0 var_ni = 0 std_gr = 0 std_ni = 0 orr = list(set([MozaikParametrized.idd(s).orientation for s in queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100).get_stimuli()])) l4_exc_or = self.datastore.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = self.parameters.sheet_name) # lets calculate spont. activity trial to trial variability # we assume that the spontaneous activity had already the spikes removed dsv = queries.param_filter_query(self.datastore,st_name='InternalStimulus',st_direct_stimulation_name='None',sheet_name=self.parameters.sheet_name,analysis_algorithm='ActionPotentialRemoval',ads_unique=True) ids = dsv.get_analysis_result()[0].ids sp = {} for idd in ids: assert len(dsv.get_analysis_result()) == 1 s = dsv.get_analysis_result()[0].get_asl_by_id(idd).magnitude sp[idd] = 1/numpy.mean(numpy.std([s[i*int(len(s)/10):(i+1)*int(len(s)/10)] for i in xrange(0,10)],axis=0,ddof=1)) #sp[idd] = 1/numpy.std(s,ddof=1) print sp[ids[1]] #lets calculate the mean of trial-to-trial variances across the neurons in the datastore for gratings dsv = queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=self.parameters.sheet_name,st_contrast=100,analysis_algorithm='TrialVariability',y_axis_name='Vm (no AP) trial-to-trial variance') assert queries.equal_ads(dsv, except_params=['stimulus_id']) ids = dsv.get_analysis_result()[0].ids var_gr_ind = [] logger.info("AA") logger.info(str([sp[i] for i in ids])) for i in ids: # find the or pereference of the neuron o = orr[numpy.argmin([circular_dist(o,l4_exc_or[0].get_value_by_id(i),numpy.pi) for o in orr])] assert len(queries.param_filter_query(dsv,st_orientation=o,ads_unique=True).get_analysis_result())==1 a = 1/numpy.mean(numpy.sqrt(queries.param_filter_query(dsv,st_orientation=o,ads_unique=True).get_analysis_result()[0].get_asl_by_id(i).magnitude)) var_gr = var_gr + a / sp[i] var_gr_ind.append(a / sp[i]) std_gr = std_gr + a var_gr = var_gr / len(ids) std_gr = std_gr / len(ids) logger.info(str(var_gr_ind)) #lets calculate the mean of trial-to-trial variances across the neurons in the datastore for natural images dsv = queries.param_filter_query(self.datastore,st_name='NaturalImageWithEyeMovement',sheet_name=self.parameters.sheet_name,y_axis_name='Vm (no AP) trial-to-trial variance',ads_unique=True) var_ni_ind = [1/numpy.mean(numpy.sqrt(dsv.get_analysis_result()[0].get_asl_by_id(i).magnitude)) / sp[i] for i in ids] var_ni = numpy.mean(var_ni_ind) plots['Bar'] = (BarComparisonPlot({"NI" : var_ni*100.0, "GR" : var_gr*100.0}),gs[0,0],{}) plots['Scatter'] = (ScatterPlot(var_gr_ind*100, var_ni_ind*100),gs[0,1],{'x_label' : 'GR', 'y_label' : 'NI','identity_line' : True}) return plots
def generate_idd_list_of_neurons(self): grid_ids = [] picked = [] assert math.fmod(self.parameters.size,self.parameters.spacing) < 0.000000001 , "Error the size has to be multiple of spacing!" z = self.sheet.pop.all_cells.astype(int) for x in self.parameters.offset_x + numpy.arange(0,self.parameters.size,self.parameters.spacing) - self.parameters.size/2.0: for y in self.parameters.offset_y + numpy.arange(0,self.parameters.size,self.parameters.spacing) - self.parameters.size/2.0: xx,yy = self.sheet.cs_2_vf(x,y) grid_ids.append(numpy.argmin(numpy.power(self.sheet.pop.positions[0] - xx,2) + numpy.power(self.sheet.pop.positions[1] - yy,2))) g = list(set(grid_ids)) vals = [self.sheet.get_neuron_annotation(idx, self.parameters.annotation) for idx in g] if self.parameters.period != 0: picked = numpy.array([i for i in xrange(0,len(g)) if abs(vals[i]-self.parameters.value) < self.parameters.distance]) else: picked = numpy.array([i for i in xrange(0,len(g)) if circular_dist(vals[i],self.parameters.value,self.parameters.period) < self.parameters.distance]) return z[picked[:]]
def perform_analysis_and_visualization(data_store): if True: analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() #find neuron with preference closet to 0 NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') l4_exc_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Exc_L4') l4_exc = analog_ids[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].get_value_by_id(analog_ids),l4_exc_phase[0].get_value_by_id(analog_ids))])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L4') l4_inh_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Inh_L4') l4_inh = analog_ids_inh[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_inh_or[0].get_value_by_id(analog_ids_inh),l4_inh_phase[0].get_value_by_id(analog_ids_inh))])] l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] print "Prefered orientation of plotted exc neurons:" print 'index ' + str(l4_exc) print "Prefered phase of plotted exc neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) print "Prefered orientation of plotted inh neurons:" print l4_inh_phase[0].get_value_by_id(l4_inh) print 'index ' + str(l4_inh) print "Prefered phase of plotted inh neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) if False: #data_store.remove_ads_from_datastore() dsv = param_filter_query(data_store,sheet_name='V1_Exc_L4') ActionPotentialRemoval(dsv,ParameterSet({'window_length' : 10.0})).analyse() TrialAveragedFiringRate(param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],st_name="FullfieldDriftingSinusoidalGrating"),ParameterSet({})).analyse() dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate',sheet_name=['V1_Exc_L4','V1_Inh_L4']) GaussianTuningCurveFit(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4']) Analog_F0andF1(dsv,ParameterSet({})).analyse() data_store.save() Analog_MeanSTDAndFanoFactor(data_store,ParameterSet({})).analyse() #data_store.save() PSTH(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'bin_length' : 2.0 })).analyse() GSTA(param_filter_query(data_store,sheet_name='V1_Exc_L4',st_name='InternalStimulus',direct_stimulation_name='None'),ParameterSet({'neurons' : [l4_exc], 'length' : 250.0 }),tags=['GSTA']).analyse() GSTA(param_filter_query(data_store,sheet_name='V1_Exc_L4',st_name='FullfieldDriftingSinusoidalGrating',st_orientation=[0,numpy.pi/2]),ParameterSet({'neurons' : [l4_exc], 'length' : 250.0 }),tags=['GSTA']).analyse() GSTA(param_filter_query(data_store,sheet_name='V1_Inh_L4',st_name='FullfieldDriftingSinusoidalGrating',st_orientation=[0,numpy.pi/2]),ParameterSet({'neurons' : [l4_inh], 'length' : 250.0 }),tags=['GSTA']).analyse() GSTA(param_filter_query(data_store,sheet_name='V1_Exc_L4',st_name='NaturalImageWithEyeMovement'),ParameterSet({'neurons' : [l4_exc], 'length' : 250.0 }),tags=['GSTA']).analyse() #data_store.print_content(full_ADS=True) #Precision(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'bin_length' : 10.0 })).analyse() #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement',sheet_name='V1_Exc_L4',analysis_algorithm='ActionPotentialRemoval') #TrialVariability(dsv,ParameterSet({'vm': False, 'cond_exc': False, 'cond_inh': False})).analyse() dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name='V1_Exc_L4',st_contrast=100,analysis_algorithm='ActionPotentialRemoval') TrialVariability(dsv,ParameterSet({'vm': False, 'cond_exc': False, 'cond_inh': False})).analyse() dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate',sheet_name=['V1_Exc_L4','V1_Inh_L4']) PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() pnv = param_filter_query(data_store,st_name='InternalStimulus',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_MeanSTDAndFanoFactor'],value_name='Mean(ECond)',st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_F0andF1'],value_name='F0_Exc_Cond') SubtractPNVfromPNVS(pnv,dsv,ParameterSet({})).analyse() pnv = param_filter_query(data_store,st_name='InternalStimulus',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_MeanSTDAndFanoFactor'],value_name='Mean(ICond)',st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_F0andF1'],value_name='F0_Inh_Cond') SubtractPNVfromPNVS(pnv,dsv,ParameterSet({})).analyse() pnv = param_filter_query(data_store,st_name='InternalStimulus',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_MeanSTDAndFanoFactor'],value_name='Mean(VM)',st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name='V1_Exc_L4',analysis_algorithm=['Analog_F0andF1'],value_name='F0_Vm') SubtractPNVfromPNVS(pnv,dsv,ParameterSet({})).analyse() TrialToTrialCrossCorrelationOfAnalogSignalList(param_filter_query(data_store,sheet_name='V1_Exc_L4',st_name="NaturalImageWithEyeMovement",analysis_algorithm='ActionPotentialRemoval'),ParameterSet({'neurons' : list(analog_ids)})).analyse() TrialToTrialCrossCorrelationOfAnalogSignalList(param_filter_query(data_store,sheet_name='V1_Exc_L4',st_name="NaturalImageWithEyeMovement",analysis_algorithm='PSTH'),ParameterSet({'neurons' : list(analog_ids)})).analyse() data_store.save() dsv = param_filter_query(data_store,analysis_algorithm='TrialToTrialCrossCorrelationOfAnalogSignalList') dsv.print_content(full_ADS=True) if True: # PLOTTING #TrialCrossCorrelationAnalysis(data_store,ParameterSet({'neurons' : list(analog_ids)}),fig_param={"dpi" : 100,"figsize": (25,12)},plot_file_name="trial-to-trial-cross-correlation.png").plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[0]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR1.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[1]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR2.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[2]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR3.png').plot() dsv = param_filter_query(data_store,st_name=['InternalStimulus']) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (28,12)},plot_file_name='SSExcAnalog.png').plot() OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : analog_ids_inh[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (28,12)},plot_file_name='SSInhAnalog.png').plot() #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='FullfieldDriftingSinusoidalGrating',st_trial=0) #VmPlot(dsv,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'})).plot({'Vm_plot.y_lim' : (-67,-56)}) #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='ActionPotentialRemoval',st_trial=0) #AnalogSignalListPlot(dsv,ParameterSet({'neurons' : [l4_exc],'sheet_name' : 'V1_Exc_L4'})).plot({'AnalogSignalPlot.y_lim' : (-67,-56)}) #RetinalInputMovie(data_store,ParameterSet({'frame_rate' : 10})).plot() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],value_name='LGNAfferentOrientation') #PerNeuronValuePlot(dsv,ParameterSet({}),plot_file_name="LGNAfferentOrientation.png").plot() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],value_name='orientation preference',analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #PerNeuronValuePlot(dsv,ParameterSet({})).plot() #dsv = param_filter_query(data_store,value_name=['orientation HWHH'],sheet_name=['V1_Exc_L4','V1_Inh_L4']) #PerNeuronValueScatterPlot(dsv,ParameterSet({})).plot({ 'ScatterPlot.x_lim' : (0,90), 'ScatterPlot.y_lim' : (0,90), 'ScatterPlot.identity_line' : True}) #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[0]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR1.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[1]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR2.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[2]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR3.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[0],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison1.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[1],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison2.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[2],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison3.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[3],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison4.png').plot() #TrialToTrialVariabilityComparison(data_store,ParameterSet({}),plot_file_name='TtTVar.png').plot() #ConductanceAndVmTuningSummary(data_store,ParameterSet({'many' : True,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (25,16)},plot_file_name='Cond&VMTuning.png').plot() #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement') #KremkowOverviewFigure(dsv,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name='NMOverview.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name='StimulusResponseComparison.png').plot() #OrientationTuningSummary(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (20,12)},plot_file_name='OrientationTuningSummary.png').plot() if True: #OverviewPlot(data_store,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="All.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',st_orientation=[0,numpy.pi/2]) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc1.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc2.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc3.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[1], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[2], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc5.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[3], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc6.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[4], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc7.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[5], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc8.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[6], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc9.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[7], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc10.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="Inh.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'X_ON', 'neuron' : sorted(param_filter_query(data_store,sheet_name="X_ON").get_segments()[0].get_stored_esyn_ids())[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="LGN0On.png").plot() OverviewPlot(dsv,ParameterSet({'sheet_name' : 'X_OFF', 'neuron' : sorted(param_filter_query(data_store,sheet_name="X_OFF").get_segments()[0].get_stored_esyn_ids())[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="LGN0Off.png").plot() OverviewPlot(dsv,ParameterSet({'sheet_name' : 'X_ON', 'neuron' : sorted(param_filter_query(data_store,sheet_name="X_ON").get_segments()[0].get_stored_esyn_ids())[1], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="LGN1On.png").plot() OverviewPlot(dsv,ParameterSet({'sheet_name' : 'X_OFF', 'neuron' : sorted(param_filter_query(data_store,sheet_name="X_OFF").get_segments()[0].get_stored_esyn_ids())[1], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="LGN1Off.png").plot() #TrialAveragedFiringRate(param_filter_query(data_store,sheet_name=['X_ON'],st_name="DriftingSinusoidalGratingDisk"),ParameterSet({})).analyse() ##dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingDisk',analysis_algorithm=['TrialAveragedFiringRate']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'spatial_frequency', 'neurons': list(sorted(param_filter_query(data_store,sheet_name="X_ON").get_segments()[0].get_stored_esyn_ids())), 'sheet_name' : 'X_ON','centered' : False,'mean' : False})).plot({'TuningCurve F0_Inh_Cond.y_lim' : (0,180) , 'TuningCurve F0_Exc_Cond.y_lim' : (0,80)}) #import pylab #pylab.show() if True: dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement') OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc2.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc3.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[1], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[2], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc5.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[3], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc6.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[4], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc7.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[5], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc8.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[6], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc9.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[7], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="NatExc10.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'X_ON', 'neuron' : sorted(param_filter_query(data_store,sheet_name="X_ON").get_segments()[0].get_stored_esyn_ids())[0], 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="LGN0On.png").plot() import pylab pylab.show() if False: dsv = param_filter_query(data_store,st_name='DriftingSineGratingWithEyeMovement') OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc2.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[0], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc3.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[1], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[2], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc5.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[3], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc6.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[4], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc7.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[5], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc8.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[6], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc9.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : analog_ids[7], 'sheet_activity' : {},'spontaneous' : True}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="DGExc10.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) # tuninc curves dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids), 'sheet_name' : 'V1_Exc_L4','centered' : True,'mean' : False,'polar' : False, 'pool' : False}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name="TCExc.png").plot({'TuningCurve F0_Inh_Cond.y_lim' : (0,180) , 'TuningCurve F0_Exc_Cond.y_lim' : (0,80)}) PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name' : 'V1_Inh_L4','centered' : True,'mean' : False,'polar' : False, 'pool' : False}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name="TCInh.png").plot({'TuningCurve F0_Inh_Cond.y_lim' : (0,180) , 'TuningCurve F0_Exc_Cond.y_lim' : (0,80)}) dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['Analog_MeanSTDAndFanoFactor']) PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids), 'sheet_name' : 'V1_Exc_L4','centered' : True,'mean' : False,'polar' : False, 'pool' : False}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name="TCExcA.png").plot() PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name' : 'V1_Inh_L4','centered' : True,'mean' : False,'polar' : False, 'pool' : False}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name="TCInhA.png").plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() import pylab pylab.show()
def plot(self): self.fig = pylab.figure(facecolor='w', **self.fig_param) gs = gridspec.GridSpec(1, 1) gs.update(left=0.07, right=0.97, top=0.9, bottom=0.1) gs = gs[0,0] gs = gridspec.GridSpecFromSubplotSpec(4, 5,subplot_spec=gs) orr = list(set([MozaikParametrized.idd(s).orientation for s in queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100).get_stimuli()])) l4_exc_or = self.datastore.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') col = orr[numpy.argmin([circular_dist(o,l4_exc_or[0].get_value_by_id(self.parameters.neuron),numpy.pi) for o in orr])] #segs = queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100,st_orientation=col,sheet_name='V1_Exc_L4').get_segments() #signals = [seg.get_vm(self.parameters.neuron) for seg in segs] dsv = queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',sheet_name='V1_Exc_L4',st_contrast=100,analysis_algorithm='ActionPotentialRemoval',st_orientation=col) assert queries.ads_with_equal_stimuli(dsv,except_params=["trial"]) adss = dsv.get_analysis_result() signals = [ads.get_asl_by_id(self.parameters.neuron) for ads in adss] (signal,noise,snr) = self.wavelet_decomposition(signals) ax = pylab.subplot(gs[0,0:2]) for s in signals: ax.plot(s,c='k') pylab.ylabel('Vm') pylab.title("Gratings",fontsize=20) pylab.xlim(0,len(signals[0])) pylab.ylim(-80,-50) ax = pylab.subplot(gs[1,0:2]) ax.imshow(signal,aspect='auto',origin='lower') pylab.ylabel('Signal') ax = pylab.subplot(gs[2,0:2]) ax.imshow(noise,aspect='auto',origin='lower') pylab.ylabel('Noise') ax = pylab.subplot(gs[3,0:2]) ax.imshow(snr,aspect='auto',origin='lower') pylab.ylabel('SNR') pylab.xlabel('time') #segs = queries.param_filter_query(self.datastore,st_name='NaturalImageWithEyeMovement',sheet_name='V1_Exc_L4').get_segments() #signals = [seg.get_vm(self.parameters.neuron) for seg in segs] dsv = queries.param_filter_query(self.datastore,st_name='NaturalImageWithEyeMovement',sheet_name='V1_Exc_L4',analysis_algorithm='ActionPotentialRemoval') assert queries.ads_with_equal_stimuli(dsv,except_params=["trial"]) adss = dsv.get_analysis_result() signals = [ads.get_asl_by_id(self.parameters.neuron) for ads in adss] (signal_ni,noise_ni,snr_ni) = self.wavelet_decomposition(signals) ax = pylab.subplot(gs[0,2:4]) for s in signals: ax.plot(s,c='k') pylab.xlim(0,len(signals[0])) pylab.ylim(-80,-50) pylab.title("NI",fontsize=20) ax = pylab.subplot(gs[1,2:4]) ax.imshow(signal_ni,aspect='auto',origin='lower') ax = pylab.subplot(gs[2,2:4]) ax.imshow(noise_ni,aspect='auto',origin='lower') ax = pylab.subplot(gs[3,2:4]) ax.imshow(snr_ni,aspect='auto',origin='lower') pylab.xlabel('time') ax = pylab.subplot(gs[1,4]) ax.plot(numpy.mean(signal,axis=1),label="GR") ax.plot(numpy.mean(signal_ni,axis=1),label="NI") ax.set_xscale('log') ax.set_yscale('log') pylab.legend() ax = pylab.subplot(gs[2,4]) ax.plot(numpy.mean(noise,axis=1)) ax.plot(numpy.mean(noise_ni,axis=1)) ax.set_xscale('log') ax.set_yscale('log') ax = pylab.subplot(gs[3,4]) ax.plot(numpy.mean(snr,axis=1)) ax.plot(numpy.mean(snr_ni,axis=1)) ax.set_xscale('log') ax.set_yscale('log') pylab.xlabel("frequency") if self.plot_file_name: pylab.savefig(Global.root_directory+self.plot_file_name)
def plot(self): self.fig = pylab.figure(facecolor='w', **self.fig_param) gs = gridspec.GridSpec(1, 1) gs.update(left=0.1, right=0.9, top=0.9, bottom=0.1) gs = gs[0,0] gs = gridspec.GridSpecFromSubplotSpec(2, 1,subplot_spec=gs) orr = list(set([MozaikParametrized.idd(s).orientation for s in queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100).get_stimuli()])) oor = self.datastore.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = self.parameters.sheet_name) if True: for neuron_idd in self.parameters.neurons: col = orr[numpy.argmin([circular_dist(o,oor[0].get_value_by_id(neuron_idd),numpy.pi) for o in orr])] dsv = queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100,st_orientation=col,sheet_name=self.parameters.sheet_name,analysis_algorithm='ActionPotentialRemoval') TrialToTrialCrossCorrelationOfAnalogSignalList(dsv,ParameterSet({'neurons' : [neuron_idd]}),tags=['helper']).analyse() dsv = queries.param_filter_query(self.datastore,st_name='FullfieldDriftingSinusoidalGrating',st_contrast=100,st_orientation=col,sheet_name=self.parameters.sheet_name,analysis_algorithm='PSTH') TrialToTrialCrossCorrelationOfAnalogSignalList(dsv,ParameterSet({'neurons' : [neuron_idd]}),tags=['helper']).analyse() dsv = queries.tag_based_query(self.datastore,['helper']) dsv1 = queries.param_filter_query(dsv,y_axis_name='trial-trial cross-correlation of Vm (no AP)',st_name='FullfieldDriftingSinusoidalGrating',sheet_name=self.parameters.sheet_name) vm_cc_gr = numpy.mean(numpy.array([asl.asl[0] for asl in dsv1.get_analysis_result()]),axis=0) dsv1 = queries.param_filter_query(dsv,y_axis_name='trial-trial cross-correlation of psth (bin=2.0)',st_name='FullfieldDriftingSinusoidalGrating',sheet_name=self.parameters.sheet_name) psth_cc_gr = numpy.mean(numpy.array([asl.asl[0] for asl in dsv1.get_analysis_result()]),axis=0) #queries.param_filter_query(self.datastore,analysis_algorithm='TrialToTrialCrossCorrelationOfAnalogSignalList').print_content(full_ADS=True) dsv = queries.param_filter_query(self.datastore,y_axis_name='trial-trial cross-correlation of Vm (no AP)',st_name="NaturalImageWithEyeMovement",sheet_name=self.parameters.sheet_name,ads_unique=True) vm_cc_ni = numpy.mean(numpy.array(dsv.get_analysis_result()[0].asl),axis=0) dsv = queries.param_filter_query(self.datastore,y_axis_name='trial-trial cross-correlation of psth (bin=2.0)',st_name="NaturalImageWithEyeMovement",sheet_name=self.parameters.sheet_name,ads_unique=True) psth_cc_ni = numpy.mean(numpy.array(dsv.get_analysis_result()[0].asl),axis=0) logger.info(str(vm_cc_gr)) logger.info(str(vm_cc_ni)) z = int(min(self.parameters.window_length,len(vm_cc_gr-1)/2,len(vm_cc_ni-1)/2)/2)*2 logger.info(str(psth_cc_ni)) logger.info(str(psth_cc_gr)) fontsize = 30 pylab.rcParams['xtick.major.pad'] = fontsize-5 pylab.rcParams['ytick.major.pad'] = 10 pylab.rc('axes', linewidth=5) logger.info(len(vm_cc_gr[int(len(vm_cc_gr)/2)-z:int(len(vm_cc_gr)/2)+z+1])) logger.info(len(numpy.linspace(-z,z,2*z+1))) ax = pylab.subplot(gs[0,0]) ax.plot(numpy.linspace(-z,z,2*z+1),vm_cc_gr[int(len(vm_cc_gr)/2)-z:int(len(vm_cc_gr)/2)+z+1],label="Gratings") ax.plot(numpy.linspace(-z,z,2*z+1),vm_cc_ni[int(len(vm_cc_ni)/2)-z:int(len(vm_cc_ni)/2)+z+1],label="Natural images") pylab.legend() pylab.title("VM") pylab.xlabel("time (ms)") #pylab.ylabel("corr coef") ax = pylab.subplot(gs[1,0]) ax.plot(numpy.linspace(-z,z,z+1),psth_cc_gr[int(len(psth_cc_gr)/2)-z/2:int(len(psth_cc_gr)/2)+z/2+1],label="Gratings") ax.plot(numpy.linspace(-z,z,z+1),psth_cc_ni[int(len(psth_cc_ni)/2)-z/2:int(len(psth_cc_ni)/2)+z/2+1],label="Natural images") pylab.xlim(-z,z) pylab.xticks([-z,0,z],[-250,0,250])#[-2*z,0,2*z]) pylab.yticks([-1.0,0.0,1.0]) #pylab.legend() #pylab.title("Spikes") #pylab.xlabel("time (ms)",fontsize=fontsize) #pylab.ylabel("corr. coef.",fontsize=fontsize) #three_tick_axis(pylab.gca().xaxis) for label in ax.get_xticklabels() + ax.get_yticklabels(): label.set_fontsize(fontsize) if self.plot_file_name: pylab.savefig(Global.root_directory+self.plot_file_name)
def perform_analysis(self): for sheet in self.datastore.sheets(): # Load up spike trains for the right sheet and the corresponding # stimuli, and transform spike trains into psth dsv = queries.param_filter_query(self.datastore,identifier='AnalogSignalList',sheet_name=sheet,analysis_algorithm='PSTH',st_name='FullfieldDriftingSinusoidalGrating') assert queries.equal_ads(dsv,except_params=['stimulus_id']) , "It seems PSTH computed in different ways are present in datastore, ModulationRatio can accept only one" psths = dsv.get_analysis_result() st = [MozaikParametrized.idd(p.stimulus_id) for p in psths] # average across trials psths, stids = colapse(psths,st,parameter_list=['trial'],func=neo_sum,allow_non_identical_objects=True) # retrieve the computed orientation preferences pnvs = self.datastore.get_analysis_result(identifier='PerNeuronValue', sheet_name=sheet, value_name='orientation preference') if len(pnvs) != 1: logger.error("ERROR: Expected only one PerNeuronValue per sheet " "with value_name 'orientation preference' in datastore, got: " + str(len(pnvs))) return None or_pref = pnvs[0] # find closest orientation of grating to a given orientation preference of a neuron # first find all the different presented stimuli: ps = OrderedDict() for s in st: ps[MozaikParametrized.idd(s).orientation] = True ps = ps.keys() # now find the closest presented orientations closest_presented_orientation = [] for i in xrange(0, len(or_pref.values)): circ_d = 100000 idx = 0 for j in xrange(0, len(ps)): if circ_d > circular_dist(or_pref.values[i], ps[j], numpy.pi): circ_d = circular_dist(or_pref.values[i], ps[j], numpy.pi) idx = j closest_presented_orientation.append(ps[idx]) closest_presented_orientation = numpy.array(closest_presented_orientation) # collapse along orientation - we will calculate MR for each # parameter combination other than orientation d = colapse_to_dictionary(psths, stids, "orientation") for (st, vl) in d.items(): # here we will store the modulation ratios, one per each neuron modulation_ratio = [] f0 = [] f1 = [] ids = [] frequency = MozaikParametrized.idd(st).temporal_frequency * MozaikParametrized.idd(st).getParams()['temporal_frequency'].units for (orr, ppsth) in zip(vl[0], vl[1]): for j in numpy.nonzero(orr == closest_presented_orientation)[0]: if or_pref.ids[j] in ppsth.ids: a = or_pref.ids[j] mr,F0,F1 = self._calculate_MR(ppsth.get_asl_by_id(or_pref.ids[j]).flatten(),frequency) modulation_ratio.append(mr) f0.append(F0) f1.append(F1) ids.append(or_pref.ids[j]) logger.debug('Adding PerNeuronValue:' + str(sheet)) self.datastore.full_datastore.add_analysis_result( PerNeuronValue(modulation_ratio, ids, qt.dimensionless, value_name='Modulation ratio' + '(' + psths[0].x_axis_name + ')', sheet_name=sheet, tags=self.tags, period=None, analysis_algorithm=self.__class__.__name__, stimulus_id=str(st))) self.datastore.full_datastore.add_analysis_result( PerNeuronValue(f0, ids, qt.dimensionless, value_name='F0' + '(' + psths[0].x_axis_name + ')', sheet_name=sheet, tags=self.tags, period=None, analysis_algorithm=self.__class__.__name__, stimulus_id=str(st))) self.datastore.full_datastore.add_analysis_result( PerNeuronValue(f1, ids, qt.dimensionless, value_name='F1' + '(' + psths[0].x_axis_name + ')', sheet_name=sheet, tags=self.tags, period=None, analysis_algorithm=self.__class__.__name__, stimulus_id=str(st))) import pylab pylab.figure() pylab.hist(modulation_ratio)
setup_logging() data_store = PickledDataStore(load=True,parameters=ParameterSet({'root_directory':'ST'})) logger.info('Loaded data store') NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() # find neuron with preference closet to 0 analog_indexes = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_isyn_ids() analog_indexes_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_isyn_ids() #find neuron with preference closet to 0 NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') l4_exc_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Exc_L4') l4_exc = analog_indexes[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].get_value_by_id(analog_indexes),l4_exc_phase[0].get_value_by_id(analog_indexes))])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L4') l4_inh_phase = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentPhase', sheet_name = 'V1_Inh_L4') l4_inh = analog_indexes_inh[numpy.argmin([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_inh_or[0].get_value_by_id(analog_indexes_inh),l4_inh_phase[0].get_value_by_id(analog_indexes_inh))])] l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,numpy.pi/2,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] os.mkdir('REPORT') l4_exc_data = param_filter_query(data_store,sheet_name='V1_Exc_L4') l4_inh_data = param_filter_query(data_store,sheet_name='V1_Inh_L4') dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',contrast=100) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),plot_file_name='REPORT/GratingsExc.png',fig_param={'dpi' : 100,'figsize': (14,8)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),plot_file_name='REPORT/GratingsInh.png',fig_param={'dpi' : 100,'figsize': (14,8)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement')
def perform_analysis(self): for sheet in self.datastore.sheets(): # Load up spike trains for the right sheet and the corresponding # stimuli, and transform spike trains into psth print sheet self.datastore.print_content() dsv = queries.param_filter_query(self.datastore,identifier='AnalogSignalList',sheet_name=sheet,analysis_algorithm='PSTH',st_name='FullfieldDriftingSinusoidalGrating') dsv.print_content() assert queries.equal_ads(dsv,except_params=['stimulus_id']) , "It seems PSTH computed in different ways are present in datastore, ModulationRatio can accept only one" psths = dsv.get_analysis_result() st = [MozaikParametrized.idd(p.stimulus_id) for p in psths] # average across trials psths, stids = colapse(psths,st,parameter_list=['trial'],func=neo_sum,allow_non_identical_objects=True) # retrieve the computed orientation preferences pnvs = self.datastore.get_analysis_result(identifier='PerNeuronValue', sheet_name=sheet, value_name='orientation preference') if len(pnvs) != 1: logger.error("ERROR: Expected only one PerNeuronValue per sheet " "with value_name 'orientation preference' in datastore, got: " + str(len(pnvs))) return None or_pref = pnvs[0] # find closest orientation of grating to a given orientation preference of a neuron # first find all the different presented stimuli: ps = {} for s in st: ps[MozaikParametrized.idd(s).orientation] = True ps = ps.keys() print ps # now find the closest presented orientations closest_presented_orientation = [] for i in xrange(0, len(or_pref.values)): circ_d = 100000 idx = 0 for j in xrange(0, len(ps)): if circ_d > circular_dist(or_pref.values[i], ps[j], numpy.pi): circ_d = circular_dist(or_pref.values[i], ps[j], numpy.pi) idx = j closest_presented_orientation.append(ps[idx]) closest_presented_orientation = numpy.array(closest_presented_orientation) # collapse along orientation - we will calculate MR for each # parameter combination other than orientation d = colapse_to_dictionary(psths, stids, "orientation") for (st, vl) in d.items(): # here we will store the modulation ratios, one per each neuron modulation_ratio = [] ids = [] frequency = MozaikParametrized.idd(st).temporal_frequency * MozaikParametrized.idd(st).params()['temporal_frequency'].units for (orr, ppsth) in zip(vl[0], vl[1]): for j in numpy.nonzero(orr == closest_presented_orientation)[0]: if or_pref.ids[j] in ppsth.ids: modulation_ratio.append(self._calculate_MR(ppsth.get_asl_by_id(or_pref.ids[j]),frequency)) ids.append(or_pref.ids[j]) logger.debug('Adding PerNeuronValue:' + str(sheet)) self.datastore.full_datastore.add_analysis_result( PerNeuronValue(modulation_ratio, ids, qt.dimensionless, value_name='Modulation ratio' + '(' + psths[0].x_axis_name + ')', sheet_name=sheet, tags=self.tags, period=None, analysis_algorithm=self.__class__.__name__, stimulus_id=str(st))) import pylab pylab.figure() pylab.hist(modulation_ratio)
def perform_analysis_and_visualization(data_store): if True: analog_ids = param_filter_query( data_store, sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() analog_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() #find neuron with preference closet to 0 NeuronAnnotationsToPerNeuronValues(data_store, ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Exc_L4') l4_exc_phase = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentPhase', sheet_name='V1_Exc_L4') l4_exc = analog_ids[numpy.argmin([ circular_dist(o, numpy.pi / 2, numpy.pi) for (o, p) in zip(l4_exc_or[0].get_value_by_id(analog_ids), l4_exc_phase[0].get_value_by_id(analog_ids)) ])] l4_inh_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Inh_L4') l4_inh_phase = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentPhase', sheet_name='V1_Inh_L4') l4_inh = analog_ids_inh[numpy.argmin([ circular_dist(o, numpy.pi / 2, numpy.pi) for (o, p) in zip(l4_inh_or[0].get_value_by_id(analog_ids_inh), l4_inh_phase[0].get_value_by_id(analog_ids_inh)) ])] l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero( numpy.array([ circular_dist(o, numpy.pi / 2, numpy.pi) for (o, p) in zip(l4_exc_or[0].values, l4_exc_phase[0].values) ]) < 0.1)[0]] print "Prefered orientation of plotted exc neurons:" print 'index ' + str(l4_exc) print "Prefered phase of plotted exc neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) print "Prefered orientation of plotted inh neurons:" print l4_inh_phase[0].get_value_by_id(l4_inh) print 'index ' + str(l4_inh) print "Prefered phase of plotted inh neurons:" print l4_exc_phase[0].get_value_by_id(l4_exc) if False: #data_store.remove_ads_from_datastore() dsv = param_filter_query(data_store, sheet_name='V1_Exc_L4') ActionPotentialRemoval(dsv, ParameterSet({'window_length': 10.0})).analyse() TrialAveragedFiringRate( param_filter_query(data_store, sheet_name=['V1_Exc_L4', 'V1_Inh_L4'], st_name="FullfieldDriftingSinusoidalGrating"), ParameterSet({})).analyse() dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', analysis_algorithm='TrialAveragedFiringRate', sheet_name=['V1_Exc_L4', 'V1_Inh_L4']) GaussianTuningCurveFit(dsv, ParameterSet({'parameter_name': 'orientation'})).analyse() dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', sheet_name=['V1_Exc_L4', 'V1_Inh_L4']) Analog_F0andF1(dsv, ParameterSet({})).analyse() data_store.save() Analog_MeanSTDAndFanoFactor(data_store, ParameterSet({})).analyse() #data_store.save() PSTH(param_filter_query(data_store, sheet_name='V1_Exc_L4'), ParameterSet({'bin_length': 2.0})).analyse() GSTA(param_filter_query(data_store, sheet_name='V1_Exc_L4', st_name='InternalStimulus', direct_stimulation_name='None'), ParameterSet({ 'neurons': [l4_exc], 'length': 250.0 }), tags=['GSTA']).analyse() GSTA(param_filter_query(data_store, sheet_name='V1_Exc_L4', st_name='FullfieldDriftingSinusoidalGrating', st_orientation=[0, numpy.pi / 2]), ParameterSet({ 'neurons': [l4_exc], 'length': 250.0 }), tags=['GSTA']).analyse() GSTA(param_filter_query(data_store, sheet_name='V1_Inh_L4', st_name='FullfieldDriftingSinusoidalGrating', st_orientation=[0, numpy.pi / 2]), ParameterSet({ 'neurons': [l4_inh], 'length': 250.0 }), tags=['GSTA']).analyse() GSTA(param_filter_query(data_store, sheet_name='V1_Exc_L4', st_name='NaturalImageWithEyeMovement'), ParameterSet({ 'neurons': [l4_exc], 'length': 250.0 }), tags=['GSTA']).analyse() #data_store.print_content(full_ADS=True) #Precision(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'bin_length' : 10.0 })).analyse() #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement',sheet_name='V1_Exc_L4',analysis_algorithm='ActionPotentialRemoval') #TrialVariability(dsv,ParameterSet({'vm': False, 'cond_exc': False, 'cond_inh': False})).analyse() dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', sheet_name='V1_Exc_L4', st_contrast=100, analysis_algorithm='ActionPotentialRemoval') TrialVariability( dsv, ParameterSet({ 'vm': False, 'cond_exc': False, 'cond_inh': False })).analyse() dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', analysis_algorithm='TrialAveragedFiringRate', sheet_name=['V1_Exc_L4', 'V1_Inh_L4']) PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage( dsv, ParameterSet({'parameter_name': 'orientation'})).analyse() pnv = param_filter_query( data_store, st_name='InternalStimulus', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_MeanSTDAndFanoFactor'], value_name='Mean(ECond)', st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_F0andF1'], value_name='F0_Exc_Cond') SubtractPNVfromPNVS(pnv, dsv, ParameterSet({})).analyse() pnv = param_filter_query( data_store, st_name='InternalStimulus', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_MeanSTDAndFanoFactor'], value_name='Mean(ICond)', st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_F0andF1'], value_name='F0_Inh_Cond') SubtractPNVfromPNVS(pnv, dsv, ParameterSet({})).analyse() pnv = param_filter_query( data_store, st_name='InternalStimulus', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_MeanSTDAndFanoFactor'], value_name='Mean(VM)', st_direct_stimulation_name='None').get_analysis_result()[0] dsv = param_filter_query(data_store, st_name='FullfieldDriftingSinusoidalGrating', sheet_name='V1_Exc_L4', analysis_algorithm=['Analog_F0andF1'], value_name='F0_Vm') SubtractPNVfromPNVS(pnv, dsv, ParameterSet({})).analyse() TrialToTrialCrossCorrelationOfAnalogSignalList( param_filter_query(data_store, sheet_name='V1_Exc_L4', st_name="NaturalImageWithEyeMovement", analysis_algorithm='ActionPotentialRemoval'), ParameterSet({'neurons': list(analog_ids)})).analyse() TrialToTrialCrossCorrelationOfAnalogSignalList( param_filter_query(data_store, sheet_name='V1_Exc_L4', st_name="NaturalImageWithEyeMovement", analysis_algorithm='PSTH'), ParameterSet({'neurons': list(analog_ids)})).analyse() data_store.save() dsv = param_filter_query( data_store, analysis_algorithm='TrialToTrialCrossCorrelationOfAnalogSignalList') dsv.print_content(full_ADS=True) if True: # PLOTTING #TrialCrossCorrelationAnalysis(data_store,ParameterSet({'neurons' : list(analog_ids)}),fig_param={"dpi" : 100,"figsize": (25,12)},plot_file_name="trial-to-trial-cross-correlation.png").plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[0]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR1.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[1]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR2.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[2]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR3.png').plot() dsv = param_filter_query(data_store, st_name=['InternalStimulus']) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (28, 12) }, plot_file_name='SSExcAnalog.png').plot() OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Inh_L4', 'neuron': analog_ids_inh[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (28, 12) }, plot_file_name='SSInhAnalog.png').plot() #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='FullfieldDriftingSinusoidalGrating',st_trial=0) #VmPlot(dsv,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'})).plot({'Vm_plot.y_lim' : (-67,-56)}) #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='ActionPotentialRemoval',st_trial=0) #AnalogSignalListPlot(dsv,ParameterSet({'neurons' : [l4_exc],'sheet_name' : 'V1_Exc_L4'})).plot({'AnalogSignalPlot.y_lim' : (-67,-56)}) #RetinalInputMovie(data_store,ParameterSet({'frame_rate' : 10})).plot() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],value_name='LGNAfferentOrientation') #PerNeuronValuePlot(dsv,ParameterSet({}),plot_file_name="LGNAfferentOrientation.png").plot() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],value_name='orientation preference',analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #PerNeuronValuePlot(dsv,ParameterSet({})).plot() #dsv = param_filter_query(data_store,value_name=['orientation HWHH'],sheet_name=['V1_Exc_L4','V1_Inh_L4']) #PerNeuronValueScatterPlot(dsv,ParameterSet({})).plot({ 'ScatterPlot.x_lim' : (0,90), 'ScatterPlot.y_lim' : (0,90), 'ScatterPlot.identity_line' : True}) #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[0]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR1.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[1]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR2.png').plot() #SNRAnalysis(data_store,ParameterSet({"neuron" : analog_ids[2]}),fig_param={'dpi' : 100,'figsize': (25,12)},plot_file_name='SNR3.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[0],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison1.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[1],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison2.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[2],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison3.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : analog_ids[3],'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (10,12)},plot_file_name='StimulusResponseComparison4.png').plot() #TrialToTrialVariabilityComparison(data_store,ParameterSet({}),plot_file_name='TtTVar.png').plot() #ConductanceAndVmTuningSummary(data_store,ParameterSet({'many' : True,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (25,16)},plot_file_name='Cond&VMTuning.png').plot() #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement') #KremkowOverviewFigure(dsv,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name='NMOverview.png').plot() #StimulusResponseComparison(data_store,ParameterSet({'neuron' : l4_exc,'sheet_name' : 'V1_Exc_L4'}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name='StimulusResponseComparison.png').plot() #OrientationTuningSummary(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (20,12)},plot_file_name='OrientationTuningSummary.png').plot() if True: #OverviewPlot(data_store,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="All.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',st_orientation=[0,numpy.pi/2]) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (19,12)},plot_file_name="Exc1.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) dsv = param_filter_query( data_store, st_name='FullfieldDriftingSinusoidalGrating', st_contrast=100) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': l4_exc, 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc2.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc3.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[1], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc4.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[2], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc5.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[3], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc6.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[4], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc7.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[5], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc8.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[6], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc9.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[7], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="Exc10.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Inh_L4', 'neuron': l4_inh, 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="Inh.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot( dsv, ParameterSet({ 'sheet_name': 'X_ON', 'neuron': sorted( param_filter_query(data_store, sheet_name="X_ON").get_segments() [0].get_stored_esyn_ids())[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="LGN0On.png").plot() OverviewPlot( dsv, ParameterSet({ 'sheet_name': 'X_OFF', 'neuron': sorted( param_filter_query(data_store, sheet_name="X_OFF").get_segments() [0].get_stored_esyn_ids())[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="LGN0Off.png").plot() OverviewPlot( dsv, ParameterSet({ 'sheet_name': 'X_ON', 'neuron': sorted( param_filter_query(data_store, sheet_name="X_ON").get_segments() [0].get_stored_esyn_ids())[1], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="LGN1On.png").plot() OverviewPlot( dsv, ParameterSet({ 'sheet_name': 'X_OFF', 'neuron': sorted( param_filter_query(data_store, sheet_name="X_OFF").get_segments() [0].get_stored_esyn_ids())[1], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="LGN1Off.png").plot() #TrialAveragedFiringRate(param_filter_query(data_store,sheet_name=['X_ON'],st_name="DriftingSinusoidalGratingDisk"),ParameterSet({})).analyse() ##dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingDisk',analysis_algorithm=['TrialAveragedFiringRate']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'spatial_frequency', 'neurons': list(sorted(param_filter_query(data_store,sheet_name="X_ON").get_segments()[0].get_stored_esyn_ids())), 'sheet_name' : 'X_ON','centered' : False,'mean' : False})).plot({'TuningCurve F0_Inh_Cond.y_lim' : (0,180) , 'TuningCurve F0_Exc_Cond.y_lim' : (0,80)}) #import pylab #pylab.show() if True: dsv = param_filter_query(data_store, st_name='NaturalImageWithEyeMovement') OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': l4_exc, 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc2.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc3.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[1], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc4.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[2], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc5.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[3], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc6.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[4], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc7.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[5], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc8.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[6], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc9.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[7], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="NatExc10.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot( dsv, ParameterSet({ 'sheet_name': 'X_ON', 'neuron': sorted( param_filter_query(data_store, sheet_name="X_ON").get_segments() [0].get_stored_esyn_ids())[0], 'sheet_activity': {} }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="LGN0On.png").plot() import pylab pylab.show() if False: dsv = param_filter_query( data_store, st_name='DriftingSineGratingWithEyeMovement') OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': l4_exc, 'sheet_activity': {} }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc2.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[0], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc3.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[1], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc4.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[2], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc5.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[3], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc6.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[4], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc7.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[5], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc8.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[6], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc9.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) OverviewPlot(dsv, ParameterSet({ 'sheet_name': 'V1_Exc_L4', 'neuron': analog_ids[7], 'sheet_activity': {}, 'spontaneous': True }), fig_param={ 'dpi': 100, 'figsize': (19, 12) }, plot_file_name="DGExc10.png").plot({ 'Vm_plot.y_lim': (-67, -56), 'Conductance_plot.y_lim': (0, 35.0) }) # tuninc curves dsv = param_filter_query( data_store, st_name='FullfieldDriftingSinusoidalGrating', analysis_algorithm=['TrialAveragedFiringRate', 'Analog_F0andF1']) PlotTuningCurve(dsv, ParameterSet({ 'parameter_name': 'orientation', 'neurons': list(analog_ids), 'sheet_name': 'V1_Exc_L4', 'centered': True, 'mean': False, 'polar': False, 'pool': False }), fig_param={ 'dpi': 100, 'figsize': (25, 12) }, plot_file_name="TCExc.png").plot({ 'TuningCurve F0_Inh_Cond.y_lim': (0, 180), 'TuningCurve F0_Exc_Cond.y_lim': (0, 80) }) PlotTuningCurve(dsv, ParameterSet({ 'parameter_name': 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name': 'V1_Inh_L4', 'centered': True, 'mean': False, 'polar': False, 'pool': False }), fig_param={ 'dpi': 100, 'figsize': (25, 12) }, plot_file_name="TCInh.png").plot({ 'TuningCurve F0_Inh_Cond.y_lim': (0, 180), 'TuningCurve F0_Exc_Cond.y_lim': (0, 80) }) dsv = param_filter_query( data_store, st_name='FullfieldDriftingSinusoidalGrating', analysis_algorithm=['Analog_MeanSTDAndFanoFactor']) PlotTuningCurve(dsv, ParameterSet({ 'parameter_name': 'orientation', 'neurons': list(analog_ids), 'sheet_name': 'V1_Exc_L4', 'centered': True, 'mean': False, 'polar': False, 'pool': False }), fig_param={ 'dpi': 100, 'figsize': (25, 12) }, plot_file_name="TCExcA.png").plot() PlotTuningCurve(dsv, ParameterSet({ 'parameter_name': 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name': 'V1_Inh_L4', 'centered': True, 'mean': False, 'polar': False, 'pool': False }), fig_param={ 'dpi': 100, 'figsize': (25, 12) }, plot_file_name="TCInhA.png").plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() import pylab pylab.show()
def perform_analysis_and_visualization(data_store): pref_or = numpy.pi / 2 #find neuron with preference closet to pref_or l4_analog_ids = param_filter_query( data_store, sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() l4_analog_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() l23_analog_ids = param_filter_query( data_store, sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_esyn_ids() l23_analog_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_esyn_ids() NeuronAnnotationsToPerNeuronValues(data_store, ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Exc_L4') l4_exc = l4_analog_ids[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_analog_ids) ])] l4_inh_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Inh_L4') l4_inh = l4_analog_ids_inh[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_analog_ids_inh) ])] l23_exc_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Exc_L2/3') l23_exc = l23_analog_ids[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l23_exc_or[0].get_value_by_id(l23_analog_ids) ])] l23_inh_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Inh_L2/3') l23_inh = l23_analog_ids_inh[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l23_inh_or[0].get_value_by_id(l23_analog_ids_inh) ])] #l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] # Find neurons for which spikes were recorded and whose orientation is close to pref_or l4_spike_ids = param_filter_query( data_store, sheet_name="V1_Exc_L4").get_segments()[0].get_stored_spike_train_ids() l4_spike_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L4").get_segments()[0].get_stored_spike_train_ids() l23_spike_ids = param_filter_query(data_store, sheet_name="V1_Exc_L2/3").get_segments( )[0].get_stored_spike_train_ids() l23_spike_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L2/3").get_segments( )[0].get_stored_spike_train_ids() l4_spike_exc_or_close_to_pi_half = numpy.array(l4_spike_ids)[numpy.nonzero( numpy.array([ circular_dist(o, pref_or, numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_spike_ids) ]) < 0.1)[0]].tolist() l4_spike_inh_or_close_to_pi_half = numpy.array(l4_spike_ids_inh)[ numpy.nonzero( numpy.array([ circular_dist(o, pref_or, numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_spike_ids_inh) ]) < 0.1)[0]].tolist() l23_spike_exc_or_close_to_pi_half = numpy.array(l23_spike_ids)[ numpy.nonzero( numpy.array([ circular_dist(o, pref_or, numpy.pi) for o in l23_exc_or[0].get_value_by_id(l23_spike_ids) ]) < 0.1)[0]].tolist() l23_spike_inh_or_close_to_pi_half = numpy.array(l23_spike_ids_inh)[ numpy.nonzero( numpy.array([ circular_dist(o, pref_or, numpy.pi) for o in l23_inh_or[0].get_value_by_id(l23_spike_ids_inh) ]) < 0.1)[0]].tolist() print "Prefered orientation of plotted exc neurons:" print 'id: ' + str(l4_exc) print "Prefered orientation of plotted inh neurons:" print 'id: ' + str(l4_inh) if True: #ANALYSIS #TrialAveragedFiringRate(data_store,ParameterSet({'stimulus_type':"DriftingSinusoidalGratingCenterSurroundStimulus"})).analyse() TrialAveragedFiringRate(data_store, ParameterSet({})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate') #GaussianTuningCurveFit(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #Analog_F0andF1(dsv,ParameterSet({})).analyse() #TrialVariability(dsv,ParameterSet({'vm': True, 'cond_exc': False, 'cond_inh': False})).analyse() #TrialMean(dsv,ParameterSet({'vm': True, 'cond_exc': False, 'cond_inh': False})).analyse() #GSTA(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'length' : 250.0 }),tags=['GSTA']).analyse() #Precision(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'bin_length' : 10.0 })).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PSTH(dsv,ParameterSet({'bin_length' : 10.0})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],y_axis_name='psth (bin=10.0)',st_contrast=100,analysis_algorithm='PSTH') #dsv1 = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='orientation preference',st_contrast=100,analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage') #ModulationRatio(dsv+dsv1,ParameterSet({})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() #PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage(dsv,ParameterSet({'parameter_name' : 'phase'})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4'],value_name='orientation preference',st_contrast=100,analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage') #LocalHomogeneityIndex(dsv,ParameterSet({'sigma' : 0.1})).analyse() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LGNAfferentOrientation') #LocalHomogeneityIndex(dsv,ParameterSet({'sigma' : 100.0})).analyse() data_store.save() if True: # PLOTTING #verify_connectivity(data_store) activity_plot_param = { 'frame_rate': 5, 'bin_width': 20.0, 'scatter': True, 'resolution': 0 } #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='DriftingGratingWithEyeMovement') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LocalHomogeneityIndex' + '(0.1:orientation preference)') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LocalHomogeneityIndex' + '(100.0:LGNAfferentOrientation)') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='LGNAfferentOrientation') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='orientation preference',analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False, '*.x_axis' : None, '*.y_axis' : None}) #TuningComparison(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (17,7.5)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/TuningComparison.png").plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],analysis_algorithm='TrialVariability',st_orientation = 0) #PerNeuronValueScatterPlot(dsv,ParameterSet({})).plot({'ScatterPlot.identity_line' : True, 'ScatterPlot.mark_means' : True}) #dsv = param_filter_query(data_store,value_name=['orientation HWHH'],sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PerNeuronValueScatterPlot(dsv,ParameterSet({}),plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/MR.png").plot({ 'ScatterPlot.x_lim' : (0,90), 'ScatterPlot.y_lim' : (0,90), 'ScatterPlot.identity_line' : True}) #HWHH(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (8,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/HWHH.png").plot({ '*.x_lim' : (0,90), '*.y_lim' : (0,90), '*.identity_line' : True, '*.title' : None}) # LHI orientation selectivity correlation #dsv1 = param_filter_query(data_store,value_name='orientation selectivity',sheet_name=['V1_Exc_L4'],analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #dsv2 = param_filter_query(data_store,value_name='LocalHomogeneityIndex' + '(0.1:orientation preference)',sheet_name=['V1_Exc_L4']) #PerNeuronValueScatterPlot(dsv1+dsv2,ParameterSet({}),plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/LHIvsSelectivity.png").plot() #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='DriftingSinusoidalGratingDisk',st_contrast=100) #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name=['FullfieldDriftingSinusoidalGrating'],st_contrast=100) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewEXCL4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewEXCL23.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewINHL4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewINHL23.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='Null') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) # PLOT ORIENTATION TUNING dsv = param_filter_query( data_store, st_name='FullfieldDriftingSinusoidalGrating', analysis_algorithm=['TrialAveragedFiringRate']) PlotTuningCurve(dsv, ParameterSet({ 'parameter_name': 'contrast', 'neurons': l4_spike_exc_or_close_to_pi_half, 'sheet_name': 'V1_Exc_L4' }), plot_file_name="CTC.png", fig_param={ 'dpi': 200, 'figsize': (14, 3) }).plot({'TuningCurve_firing_rate.y_lim': (0, 50)}) CTC(dsv, ParameterSet({ 'l4_exc_neurons': numpy.array(l4_spike_exc_or_close_to_pi_half)[:4].tolist(), 'l4_inh_neurons': numpy.array(l4_spike_inh_or_close_to_pi_half)[:4].tolist(), 'l23_exc_neurons': numpy.array(l23_spike_exc_or_close_to_pi_half)[:4].tolist(), 'l23_inh_neurons': numpy.array(l23_spike_inh_or_close_to_pi_half)[:4].tolist() }), fig_param={ 'dpi': 100, 'figsize': (14, 12) }, plot_file_name="CTC.svg").plot({'*.title': None}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l4_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l23_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l23_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) # PLOT SIZETUNING #dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingDisk',analysis_algorithm=['TrialAveragedFiringRate']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l4_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l4_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l23_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l23_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #STC(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:6].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:6].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half)[:6].tolist(),'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:6].tolist()}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/STC.png").plot({'*.title' : None}) # PLOT OCTC #dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingCenterSurroundStimulus',analysis_algorithm=['TrialAveragedFiringRate']) #OCTC(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:5].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:5].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half).tolist()[:5],'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:5].tolist()}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/OCTC.png").plot({'*.title' : None}) # tuninc curves #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l23_analog_ids), 'sheet_name' : 'V1_Exc_L2/3'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l23_analog_ids_inh), 'sheet_name' : 'V1_Inh_L2/3'})).plot() #OR(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:4].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:4].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half)[:4].tolist(),'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:4].tolist()}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/OR.png").plot({'*.title' : None}) #MRfig(data_store,ParameterSet({'SimpleSheetName' : 'V1_Exc_L4', 'ComplexSheetName' : 'V1_Exc_L2/3',}),fig_param={'dpi' : 100,'figsize': (8,6)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/MR.png").plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() import pylab pylab.show()
def perform_analysis_and_visualization(data_store): pref_or = numpy.pi/2 #find neuron with preference closet to pref_or l4_analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() l4_analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() l23_analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_esyn_ids() l23_analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_esyn_ids() NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') l4_exc = l4_analog_ids[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_analog_ids)])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L4') l4_inh = l4_analog_ids_inh[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_analog_ids_inh)])] l23_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L2/3') l23_exc = l23_analog_ids[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l23_exc_or[0].get_value_by_id(l23_analog_ids)])] l23_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L2/3') l23_inh = l23_analog_ids_inh[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l23_inh_or[0].get_value_by_id(l23_analog_ids_inh)])] #l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] # Find neurons for which spikes were recorded and whose orientation is close to pref_or l4_spike_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_spike_train_ids() l4_spike_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_spike_train_ids() l23_spike_ids = param_filter_query(data_store,sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_spike_train_ids() l23_spike_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_spike_train_ids() l4_spike_exc_or_close_to_pi_half = numpy.array(l4_spike_ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_spike_ids)]) < 0.1)[0]].tolist() l4_spike_inh_or_close_to_pi_half = numpy.array(l4_spike_ids_inh)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_spike_ids_inh)]) < 0.1)[0]].tolist() l23_spike_exc_or_close_to_pi_half = numpy.array(l23_spike_ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for o in l23_exc_or[0].get_value_by_id(l23_spike_ids)]) < 0.1)[0]].tolist() l23_spike_inh_or_close_to_pi_half = numpy.array(l23_spike_ids_inh)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for o in l23_inh_or[0].get_value_by_id(l23_spike_ids_inh)]) < 0.1)[0]].tolist() print "Prefered orientation of plotted exc neurons:" print 'id: ' + str(l4_exc) print "Prefered orientation of plotted inh neurons:" print 'id: ' + str(l4_inh) if True: #ANALYSIS #TrialAveragedFiringRate(data_store,ParameterSet({'stimulus_type':"DriftingSinusoidalGratingCenterSurroundStimulus"})).analyse() TrialAveragedFiringRate(data_store,ParameterSet({})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate') #GaussianTuningCurveFit(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #Analog_F0andF1(dsv,ParameterSet({})).analyse() #TrialVariability(dsv,ParameterSet({'vm': True, 'cond_exc': False, 'cond_inh': False})).analyse() #TrialMean(dsv,ParameterSet({'vm': True, 'cond_exc': False, 'cond_inh': False})).analyse() #GSTA(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'length' : 250.0 }),tags=['GSTA']).analyse() #Precision(param_filter_query(data_store,sheet_name='V1_Exc_L4'),ParameterSet({'neurons' : [l4_exc], 'bin_length' : 10.0 })).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PSTH(dsv,ParameterSet({'bin_length' : 10.0})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],y_axis_name='psth (bin=10.0)',st_contrast=100,analysis_algorithm='PSTH') #dsv1 = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='orientation preference',st_contrast=100,analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage') #ModulationRatio(dsv+dsv1,ParameterSet({})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm='TrialAveragedFiringRate',sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage(dsv,ParameterSet({'parameter_name' : 'orientation'})).analyse() #PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage(dsv,ParameterSet({'parameter_name' : 'phase'})).analyse() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',sheet_name=['V1_Exc_L4'],value_name='orientation preference',st_contrast=100,analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage') #LocalHomogeneityIndex(dsv,ParameterSet({'sigma' : 0.1})).analyse() #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LGNAfferentOrientation') #LocalHomogeneityIndex(dsv,ParameterSet({'sigma' : 100.0})).analyse() data_store.save() if True: # PLOTTING #verify_connectivity(data_store) activity_plot_param = { 'frame_rate' : 5, 'bin_width' : 20.0, 'scatter' : True, 'resolution' : 0 } #dsv = param_filter_query(data_store,st_name='NaturalImageWithEyeMovement') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='DriftingGratingWithEyeMovement') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LocalHomogeneityIndex' + '(0.1:orientation preference)') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4'],value_name='LocalHomogeneityIndex' + '(100.0:LGNAfferentOrientation)') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='LGNAfferentOrientation') #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3'],value_name='orientation preference',analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #PerNeuronValuePlot(dsv,ParameterSet({})).plot({'*.colorbar' : False, '*.x_axis' : None, '*.y_axis' : None}) #TuningComparison(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (17,7.5)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/TuningComparison.png").plot({'*.colorbar' : False,'*.x_axis' : None, '*.y_axis' : None}) #dsv = param_filter_query(data_store,sheet_name=['V1_Exc_L4','V1_Inh_L4'],analysis_algorithm='TrialVariability',st_orientation = 0) #PerNeuronValueScatterPlot(dsv,ParameterSet({})).plot({'ScatterPlot.identity_line' : True, 'ScatterPlot.mark_means' : True}) #dsv = param_filter_query(data_store,value_name=['orientation HWHH'],sheet_name=['V1_Exc_L4','V1_Inh_L4','V1_Exc_L2/3','V1_Inh_L2/3']) #PerNeuronValueScatterPlot(dsv,ParameterSet({}),plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/MR.png").plot({ 'ScatterPlot.x_lim' : (0,90), 'ScatterPlot.y_lim' : (0,90), 'ScatterPlot.identity_line' : True}) #HWHH(data_store,ParameterSet({}),fig_param={'dpi' : 100,'figsize': (8,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/HWHH.png").plot({ '*.x_lim' : (0,90), '*.y_lim' : (0,90), '*.identity_line' : True, '*.title' : None}) # LHI orientation selectivity correlation #dsv1 = param_filter_query(data_store,value_name='orientation selectivity',sheet_name=['V1_Exc_L4'],analysis_algorithm='PeriodicTuningCurvePreferenceAndSelectivity_VectorAverage',st_contrast=100) #dsv2 = param_filter_query(data_store,value_name='LocalHomogeneityIndex' + '(0.1:orientation preference)',sheet_name=['V1_Exc_L4']) #PerNeuronValueScatterPlot(dsv1+dsv2,ParameterSet({}),plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/LHIvsSelectivity.png").plot() #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name='DriftingSinusoidalGratingDisk',st_contrast=100) #dsv = param_filter_query(data_store,st_orientation=[0,numpy.pi/2],st_name=['FullfieldDriftingSinusoidalGrating'],st_contrast=100) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewEXCL4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewEXCL23.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewINHL4.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="OverviewINHL23.png").plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #dsv = param_filter_query(data_store,st_name='Null') #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L4', 'neuron' : l4_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L4', 'neuron' : l4_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Exc_L2/3', 'neuron' : l23_exc, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) #OverviewPlot(dsv,ParameterSet({'sheet_name' : 'V1_Inh_L2/3', 'neuron' : l23_inh, 'sheet_activity' : {}}),fig_param={'dpi' : 100,'figsize': (14,12)}).plot({'Vm_plot.y_lim' : (-67,-56),'Conductance_plot.y_lim' : (0,35.0)}) # PLOT ORIENTATION TUNING dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate']) PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l4_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L4'}),plot_file_name="CTC.png",fig_param={'dpi' : 200,'figsize': (14,3)}).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) CTC(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:4].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:4].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half)[:4].tolist(),'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:4].tolist()}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="CTC.svg").plot({'*.title' : None}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l4_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l23_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'contrast', 'neurons': l23_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) # PLOT SIZETUNING #dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingDisk',analysis_algorithm=['TrialAveragedFiringRate']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l4_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l4_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L4'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l23_spike_exc_or_close_to_pi_half, 'sheet_name' : 'V1_Exc_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'radius', 'neurons': l23_spike_inh_or_close_to_pi_half, 'sheet_name' : 'V1_Inh_L2/3'})).plot({'TuningCurve_firing_rate.y_lim' : (0,50)}) #STC(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:6].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:6].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half)[:6].tolist(),'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:6].tolist()}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/STC.png").plot({'*.title' : None}) # PLOT OCTC #dsv = param_filter_query(data_store,st_name='DriftingSinusoidalGratingCenterSurroundStimulus',analysis_algorithm=['TrialAveragedFiringRate']) #OCTC(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:5].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:5].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half).tolist()[:5],'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:5].tolist()}),fig_param={'dpi' : 100,'figsize': (14,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/OCTC.png").plot({'*.title' : None}) # tuninc curves #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l23_analog_ids), 'sheet_name' : 'V1_Exc_L2/3'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialAveragedFiringRate','Analog_F0andF1']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l23_analog_ids_inh), 'sheet_name' : 'V1_Inh_L2/3'})).plot() #OR(dsv,ParameterSet({'l4_exc_neurons' : numpy.array(l4_spike_exc_or_close_to_pi_half)[:4].tolist(),'l4_inh_neurons' : numpy.array(l4_spike_inh_or_close_to_pi_half)[:4].tolist(),'l23_exc_neurons' : numpy.array(l23_spike_exc_or_close_to_pi_half)[:4].tolist(),'l23_inh_neurons' : numpy.array(l23_spike_inh_or_close_to_pi_half)[:4].tolist()}),fig_param={'dpi' : 100,'figsize': (16,12)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/OR.png").plot({'*.title' : None}) #MRfig(data_store,ParameterSet({'SimpleSheetName' : 'V1_Exc_L4', 'ComplexSheetName' : 'V1_Exc_L2/3',}),fig_param={'dpi' : 100,'figsize': (8,6)},plot_file_name="/home/antolikjan/Doc/Talks/JCUnicMar2013/MR.png").plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids), 'sheet_name' : 'V1_Exc_L4'})).plot() #dsv = param_filter_query(data_store,st_name='FullfieldDriftingSinusoidalGrating',analysis_algorithm=['TrialVariability']) #PlotTuningCurve(dsv,ParameterSet({'parameter_name' : 'orientation', 'neurons': list(l4_analog_ids_inh), 'sheet_name' : 'V1_Inh_L4'})).plot() import pylab pylab.show()
sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() l4_analog_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() l23_analog_ids = param_filter_query( data_store, sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_esyn_ids() l23_analog_ids_inh = param_filter_query( data_store, sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_esyn_ids() NeuronAnnotationsToPerNeuronValues(data_store, ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Exc_L4') l4_exc = l4_analog_ids[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_analog_ids) ])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Inh_L4') l4_inh = l4_analog_ids_inh[numpy.argmin([ circular_dist(o, pref_or, numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_analog_ids_inh) ])] l23_exc_or = data_store.get_analysis_result( identifier='PerNeuronValue', value_name='LGNAfferentOrientation', sheet_name='V1_Exc_L2/3') l23_exc = l23_analog_ids[numpy.argmin([ circular_dist(o, pref_or, numpy.pi)
def test_stimulating_function_Naka(sheet, coor_x, coor_y, current_update_interval, parameters): z = sheet.pop.all_cells.astype(int) vals = numpy.array([ sheet.get_neuron_annotation(i, 'LGNAfferentOrientation') for i in range(0, len(z)) ]) mean_orientations = [] # x = [] # y = [] # for (i, neuron2) in enumerate(sheet.pop.all()): # x.append(sheet.pop.positions[i][0]) # y.append(sheet.pop.positions[i][1]) # px, py = sheet.vf_2_cs(sheet.pop.positions[0], sheet.pop.positions[1]) px, py = sheet.vf_2_cs(sheet.pop.positions[:, 0], sheet.pop.positions[:, 1]) # px, py = sheet.vf_2_cs(x, y) pylab.subplot(151) pylab.gca().set_aspect('equal') pylab.title('Orientatin preference (neurons)') pylab.scatter(px, py, c=vals / numpy.pi, cmap='hsv') pylab.hold(True) ors = scipy.interpolate.griddata(zip(px, py), vals, (coor_x, coor_y), method='nearest') pylab.subplot(152) pylab.title('Orientatin preference (stimulators)') pylab.gca().set_aspect('equal') pylab.scatter(coor_x.flatten(), coor_y.flatten(), c=ors.flatten(), cmap='hsv') signals = numpy.zeros((numpy.shape(coor_x)[0], numpy.shape(coor_x)[1], int(parameters.duration / current_update_interval))) # figure out the light scale rate = parameters.nv_r_max * numpy.power( parameters.contrast.value, parameters.nv_exponent) / ( numpy.power(parameters.contrast.value, parameters.nv_exponent) + parameters.nv_c50) scale = numpy.power( rate * parameters.cs_c50 / (parameters.cs_r_max - rate), 1 / parameters.cs_exponent) for i in range(0, numpy.shape(coor_x)[0]): for j in range(0, numpy.shape(coor_x)[0]): signals[i, j, int( numpy.floor(parameters.onset_time / current_update_interval) ):int( numpy.floor(parameters.offset_time / current_update_interval) )] = scale * numpy.exp(-numpy.power( circular_dist(parameters.orientation.value, ors[i][j], numpy.pi), 2) / parameters.sharpness) pylab.subplot(153) pylab.gca().set_aspect('equal') pylab.title('Activation magnitude (stimulators)') pylab.scatter(coor_x.flatten(), coor_y.flatten(), c=numpy.squeeze(numpy.mean(signals, axis=2)).flatten(), cmap='gray') pylab.title(str(parameters.orientation.value)) return numpy.array(signals), scale
data_store = PickledDataStore(load=True,parameters=ParameterSet({'root_directory':'E'}),replace=True) logger.info('Loaded data store') import resource print "Current memory usage: %iMB" % (resource.getrusage(resource.RUSAGE_SELF).ru_maxrss/(1024)) pref_or = numpy.pi/2 #find neuron with preference closet to pref_or l4_analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_esyn_ids() l4_analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_esyn_ids() l23_analog_ids = param_filter_query(data_store,sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_esyn_ids() l23_analog_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_esyn_ids() NeuronAnnotationsToPerNeuronValues(data_store,ParameterSet({})).analyse() l4_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L4') l4_exc = l4_analog_ids[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_analog_ids)])] l4_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L4') l4_inh = l4_analog_ids_inh[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l4_inh_or[0].get_value_by_id(l4_analog_ids_inh)])] l23_exc_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Exc_L2/3') l23_exc = l23_analog_ids[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l23_exc_or[0].get_value_by_id(l23_analog_ids)])] l23_inh_or = data_store.get_analysis_result(identifier='PerNeuronValue',value_name = 'LGNAfferentOrientation', sheet_name = 'V1_Inh_L2/3') l23_inh = l23_analog_ids_inh[numpy.argmin([circular_dist(o,pref_or,numpy.pi) for o in l23_inh_or[0].get_value_by_id(l23_analog_ids_inh)])] #l4_exc_or_many = numpy.array(l4_exc_or[0].ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for (o,p) in zip(l4_exc_or[0].values,l4_exc_phase[0].values)]) < 0.1)[0]] # Find neurons for which spikes were recorded and whose orientation is close to pref_or l4_spike_ids = param_filter_query(data_store,sheet_name="V1_Exc_L4").get_segments()[0].get_stored_spike_train_ids() l4_spike_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L4").get_segments()[0].get_stored_spike_train_ids() l23_spike_ids = param_filter_query(data_store,sheet_name="V1_Exc_L2/3").get_segments()[0].get_stored_spike_train_ids() l23_spike_ids_inh = param_filter_query(data_store,sheet_name="V1_Inh_L2/3").get_segments()[0].get_stored_spike_train_ids() l4_spike_exc_or_close_to_pi_half = numpy.array(l4_spike_ids)[numpy.nonzero(numpy.array([circular_dist(o,pref_or,numpy.pi) for o in l4_exc_or[0].get_value_by_id(l4_spike_ids)]) < 0.1)[0]].tolist()