def plot_sum_for_each_animal(axsum,mn_by_animal,summary_data_location): kcol=ml.colors.colorConverter.to_rgba('k', alpha=.5) rcol=ml.colors.colorConverter.to_rgba('r', alpha=.5) axsum.scatter(np.zeros(len(mn_by_animal['on'])),mn_by_animal['on'],s=15,facecolor='none',edgecolor=kcol) axsum.scatter(np.ones(len(mn_by_animal['off']))-.5,mn_by_animal['off'],s=15,facecolor='none',edgecolor=rcol) for crind, cr_on in enumerate(mn_by_animal['on']): cr_off=mn_by_animal['off'][crind] axsum.plot([0,0.5],[cr_on,cr_off],color='k',linewidth=0.2) mn_on=np.mean(mn_by_animal['on']) mn_off=np.mean(mn_by_animal['off']) rel_stats=scipy.stats.ttest_rel(mn_by_animal['on'],mn_by_animal['off']) off_target_rel_to_zero_stats=scipy.stats.ttest_1samp(mn_by_animal['off'],0) plt.plot(1.1,mn_on,'<',Markersize=3,MarkerEdgeColor=None,color='k') plt.plot(1.1,mn_off,'<',Markersize=3,MarkerEdgeColor=None,color='r') axsum.set_ylim(-.25,1.25) axsum.set_aspect(4) axsum.set_yticks([-.25,0,.25,.5,.75]) axsum.set_xlim(-.2,1.2) fpl.adjust_spines(axsum,['left']) axsum.set_ylim(-.25,1.25) axsum.set_aspect(4) axsum.set_yticks([-.25,0,.25,.5,.75]) axsum.set_xlim(-.2,1.2) sumdt={} sumdt['mn_by_animal']=mn_by_animal sumdt['rel_stats']=rel_stats sumdt['off_targ_stats']=off_target_rel_to_zero_stats fh.save_to_pickle(summary_data_location+'summary_datwt.pck',sumdt)
#march26_animal_9_meta_dt from py_utilities import tw_filehandling as fh meta_dt = {} meta_dt['data_path'] = '/Volumes/LaCie/2pdata/march25/animal4/' meta_dt['meta_file_name'] = 'anim4_plotdata.pck' #file_names=['---Streaming Phasor Capture - 2 - 2_XY0_Z0_T0000_C0.tif'] meta_dt['file_names'] = [ '---Streaming Phasor Capture - 2 - 2_XY0_Z0_T0000_C0.tif', '---Streaming Phasor Capture - 2 - 1_XY0_Z0_T0000_C0.tif', '---Streaming Phasor Capture - 2_XY0_Z0_T0000_C0.tif' ] meta_dt['roi_to_plot'] = 0 meta_dt['on_target_depth'] = 231 meta_dt['off_target'] = 251 meta_dt['on_depths'] = 'odd' meta_dt['off_depths'] = 'even' fh.save_to_pickle(meta_dt['data_path'] + meta_dt['meta_file_name'], meta_dt)
sumdt['roi'] = my_roi sumdt['zoom_vls'] = {} sumdt['zoom_vls']['xvls'] = xvls sumdt['zoom_vls']['yvls'] = yvls (stim_tms, stim_frame_nums) = util.convert_stim_times( stim['stim_frame_nums'], frame_flag=True, time_between_frames=TIME_BETWEEN_FRAMES) frame_tms = [float(i) for i in im['time_stamps']] deltaf_vls = util.get_delta_f(mn_roi, stim_frame_nums, preframes, postframes, pre_frame_buffer=2) sumdt['im_mean'] = im_zoom_mean sumdt['stim_mask'] = stim_mask sumdt['mn_roi'] = mn_roi sumdt['roi_masks'] = masks sumdt['frame_nums'] = [int(i) for i in im['frame_nums']] sumdt['frame_tms'] = frame_tms sumdt['stim_tms'] = stim_tms sumdt['deltaf_vls'] = deltaf_vls sumdt['stim_depths'] = [float(i) for i in stim_depths] sumdt['stim_region'] = stim_region sumdt['stim_edges'] = stim_edges sumdt['stim_frame_nums'] = stim_frame_nums fh.save_to_pickle(data_path + file_name + '.pck', sumdt)