def plot(self, *args, **kwargs): # Plot all the trials into separate pages. data = self.trial_data rl, rb, rr, rt = self.myc['raster_rect'] t_limits = self.myc['t_limits'] max_e_rate = self.myc.get('max_e_rate', True) max_i_rate = self.myc.get('max_i_rate', True) scale_bar = self.myc.get('scale_bar', 500) scale_x = self.myc.get('scale_x', .85) scale_y = self.myc.get('scale_y', -.05) ann_ei = self.myc.get('ann_ei', True) y_label_pos = self.myc.get('y_label_pos', -0.22) reshape_senders = self.myc.get('reshape_senders', True) saver = self.myc['fig_saver'] saver.set_file_name(self.get_fname('population_activity')) saver.ext = "pdf" saver.set_backend_params(dpi=300, transparent=True) for trial_no in range(len(data)): fig = self._get_final_fig(self.myc['fig_size']) e_spikes = data[trial_no].get_e_spikes() i_spikes = data[trial_no].get_i_spikes() # Raster plot ax_raster = fig.add_axes(Bbox.from_extents(rl, rb, rr, rt)) plotEIRaster(e_spikes, i_spikes, t_limits, ax=ax_raster, sigmaTitle=False, markersize=2 * self.config['scale_factor'], rasterized=True, ann_EI=ann_ei, scaleBar=scale_bar, scaleX=scale_x, scaleY=scale_y, scaleTextYOffset=.02, reshape_senders=reshape_senders, ylabelPos=y_label_pos) # E and I 2D population plots win_dt = 125. # ms winLen = 250. # ms tStart = t_limits[0] tEnd = t_limits[1] - win_dt fr_e, frt_e = e_spikes.slidingFiringRate(tStart, tEnd, win_dt, winLen) e_max = examples.plotBumpSnapshots( fr_e, frt_e, self.myc['snapshot_tstep'], fig=fig, axesCoords=self.myc['e_snapshots_rect'], bumpQuality=False, timeTitles=True, maxRate=False, fontsize='x-small', rateYPos=-.2) rateText = "%.0f Hz" % e_max rect = self.myc['e_snapshots_rect'] fig.text(rect[2], rect[3], rateText, ha='left', va='top', size='small', weight='bold', clip_on=False) fr_i, frt_i = i_spikes.slidingFiringRate(tStart, tEnd, win_dt, winLen) i_max = examples.plotBumpSnapshots( fr_i, frt_i, self.myc['snapshot_tstep'], fig=fig, axesCoords=self.myc['i_snapshots_rect'], bumpQuality=False, timeTitles=False, maxRate=False, fontsize='x-small') rateText = "%.0f Hz" % i_max rect = self.myc['i_snapshots_rect'] fig.text(rect[2], rect[3], rateText, ha='left', va='top', size='small', weight='bold', clip_on=False) saver.savefig(fig) saver.close()
def plot(self, *args, **kwargs): # Plot all the trials into separate pages. data = self.trial_data rl, rb, rr, rt = self.myc['raster_rect'] t_limits = self.myc['t_limits'] max_e_rate = self.myc.get('max_e_rate', True) max_i_rate = self.myc.get('max_i_rate', True) scale_bar = self.myc.get('scale_bar', 500) scale_x = self.myc.get('scale_x', .85) scale_y = self.myc.get('scale_y', -.05) ann_ei = self.myc.get('ann_ei', True) y_label_pos = self.myc.get('y_label_pos', -0.22) reshape_senders = self.myc.get('reshape_senders', True) saver = self.myc['fig_saver'] saver.set_file_name(self.get_fname('population_activity')) saver.ext = "pdf" saver.set_backend_params(dpi=300, transparent=True) for trial_no in range(len(data)): fig = self._get_final_fig(self.myc['fig_size']) e_spikes = data[trial_no].get_e_spikes() i_spikes = data[trial_no].get_i_spikes() # Raster plot ax_raster = fig.add_axes(Bbox.from_extents(rl, rb, rr, rt)) plotEIRaster(e_spikes, i_spikes, t_limits, ax=ax_raster, sigmaTitle=False, markersize=2 * self.config['scale_factor'], rasterized=True, ann_EI=ann_ei, scaleBar=scale_bar, scaleX=scale_x, scaleY=scale_y, scaleTextYOffset=.02, reshape_senders=reshape_senders, ylabelPos=y_label_pos) # E and I 2D population plots win_dt = 125. # ms winLen = 250. # ms tStart = t_limits[0] tEnd = t_limits[1] - win_dt fr_e, frt_e = e_spikes.slidingFiringRate(tStart, tEnd, win_dt, winLen) e_max = examples.plotBumpSnapshots(fr_e, frt_e, self.myc['snapshot_tstep'], fig=fig, axesCoords=self.myc['e_snapshots_rect'], bumpQuality=False, timeTitles=True, maxRate=False, fontsize='x-small', rateYPos=-.2) rateText = "%.0f Hz" % e_max rect = self.myc['e_snapshots_rect'] fig.text(rect[2], rect[3], rateText, ha='left', va='top', size='small', weight='bold', clip_on=False) fr_i, frt_i = i_spikes.slidingFiringRate(tStart, tEnd, win_dt, winLen) i_max = examples.plotBumpSnapshots(fr_i, frt_i, self.myc['snapshot_tstep'], fig=fig, axesCoords=self.myc['i_snapshots_rect'], bumpQuality=False, timeTitles=False, maxRate=False, fontsize='x-small') rateText = "%.0f Hz" % i_max rect = self.myc['i_snapshots_rect'] fig.text(rect[2], rect[3], rateText, ha='left', va='top', size='small', weight='bold', clip_on=False) saver.savefig(fig) saver.close()
def plot(self, *args, **kwargs): myc = self._get_class_config() tLimits = [5.e3, 6e3] fig = self._get_final_fig(self.myc['fig_size']) gs = gridspec.GridSpec(3, 1, height_ratios=(2.5, 1, 1)) data = DataStorage.open(self.myc['data_file'], 'r') trial_data = data['trials'][0] events_e = trial_data['spikeMon_e']['events'] ESpikes = PopulationSpikes(trial_data['net_attr']['net_Ne'], events_e['senders'], events_e['times']) events_i = trial_data['spikeMon_i']['events'] ISpikes = PopulationSpikes(trial_data['net_attr']['net_Ni'], events_i['senders'], events_i['times']) # EI Raster ax_raster = fig.add_subplot(gs[0, 0]) rasters.plotEIRaster(ESpikes, ISpikes, ylabelPos=self.myc['ylabelPos'], tLimits=tLimits, markersize=self.config['scale_factor'] * self.myc['markersize'], yticks=True, sigmaTitle=False, ann_EI=False, scaleBar=125, scaleX=.8, scaleY=-.05, scaleText='ms', scaleTextYOffset=.03, scaleHeight=.01, rasterized=False, reshape_senders=False) # EI rates ax_erates = fig.add_subplot(gs[1, 0]) ax_irates = fig.add_subplot(gs[2, 0]) rasters.plot_avg_firing_rate_spikes(ESpikes, ylabelPos=self.myc['ylabelPos'], color='red', tLimits=tLimits, ax=ax_erates, dt=.5, winLen=2.) rasters.plot_avg_firing_rate_spikes(ISpikes, ylabelPos=self.myc['ylabelPos'], color='blue', tLimits=tLimits, ax=ax_irates, dt=.5, winLen=2.) gsl = .12 gsb = .02 gsr = .95 gst = .95 #fig.text(0.01, gst, 'B', size=16, weight='bold', # va='bottom', ha='left') gs.update(left=gsl, bottom=gsb, right=gsr, top=gst, hspace=.2) ax_theta = fig.add_axes( Bbox.from_extents(gsl, gst - .015, gsr, gst + .01)) t = np.arange(tLimits[0], tLimits[1] + self.dt, self.dt) theta = self.const + .5 * (1. + np.cos(2 * np.pi * self.freq * 1e-3 * t - np.pi)) * (1 - self.const) ax_theta.fill_between(t, theta, edgecolor='None', color=self.myc['theta_color']) ax_theta.set_xlim([tLimits[0], tLimits[1]]) ax_theta.set_ylim(-.02, 1.02) ax_theta.axis('off') plt.savefig(self.get_fname('pastoll_et_al_rasters.pdf'), dpi=300, transparent=True) plt.close(fig)
def plot(self, *args, **kwargs): myc= self._get_class_config() tLimits = [5.e3, 6e3] fig = self._get_final_fig(self.myc['fig_size']) gs = gridspec.GridSpec(3, 1, height_ratios=(2.5, 1, 1)) data = DataStorage.open(self.myc['data_file'], 'r') trial_data = data['trials'][0] events_e = trial_data['spikeMon_e']['events'] ESpikes = PopulationSpikes(trial_data['net_attr']['net_Ne'], events_e['senders'], events_e['times']) events_i = trial_data['spikeMon_i']['events'] ISpikes = PopulationSpikes(trial_data['net_attr']['net_Ni'], events_i['senders'], events_i['times']) # EI Raster ax_raster = fig.add_subplot(gs[0, 0]) rasters.plotEIRaster( ESpikes, ISpikes, ylabelPos=self.myc['ylabelPos'], tLimits=tLimits, markersize=self.config['scale_factor']*self.myc['markersize'], yticks=True, sigmaTitle=False, ann_EI=False, scaleBar=125, scaleX=.8, scaleY=-.05, scaleText='ms', scaleTextYOffset=.03, scaleHeight=.01, rasterized=False, reshape_senders=False) # EI rates ax_erates = fig.add_subplot(gs[1, 0]) ax_irates = fig.add_subplot(gs[2, 0]) rasters.plot_avg_firing_rate_spikes(ESpikes, ylabelPos=self.myc['ylabelPos'], color='red', tLimits=tLimits, ax=ax_erates, dt=.5, winLen=2.) rasters.plot_avg_firing_rate_spikes(ISpikes, ylabelPos=self.myc['ylabelPos'], color='blue', tLimits=tLimits, ax=ax_irates, dt=.5, winLen=2.) gsl = .12 gsb = .02 gsr = .95 gst = .95 #fig.text(0.01, gst, 'B', size=16, weight='bold', # va='bottom', ha='left') gs.update(left=gsl, bottom=gsb, right=gsr, top=gst, hspace=.2) ax_theta = fig.add_axes(Bbox.from_extents(gsl, gst - .015, gsr, gst + .01)) t = np.arange(tLimits[0], tLimits[1]+self.dt, self.dt) theta = self.const + .5 * (1. + np.cos(2*np.pi*self.freq*1e-3*t - np.pi)) * (1 - self.const) ax_theta.fill_between(t, theta, edgecolor='None', color=self.myc['theta_color']) ax_theta.set_xlim([tLimits[0], tLimits[1]]) ax_theta.set_ylim(-.02, 1.02) ax_theta.axis('off') plt.savefig(self.get_fname('pastoll_et_al_rasters.pdf'), dpi=300, transparent=True) plt.close(fig)