def import_data(): ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' #HP_LFP,PFC_LFP, m484_LFP, m479_LFP, m483_LFP, m478_LFP, m486_LFP, m480_LFP, m481_LFP, all_sessions_LFP = ep.import_code(ephys_path,beh_path, lfp_analyse = 'True') HP,PFC, m484, m479, m483, m478, m486, m480, m481, all_sessions = ep.import_code(ephys_path,beh_path,lfp_analyse = 'False') exp = di.Experiment('/Users/veronikasamborska/Desktop/Veronika Backup/2018-12-12-Reversal_learning/data_pilot3')
def load_data(): ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' HP,PFC, m484, m479, m483, m478, m486, m480, m481, all_sessions = ep.import_code(ephys_path,beh_path,lfp_analyse = 'False') experiment_aligned_PFC = ha.all_sessions_aligment(PFC, all_sessions) experiment_aligned_HP = ha.all_sessions_aligment(HP, all_sessions) data_HP = io.loadmat('/Users/veronikasamborska/Desktop/HP.mat') data_PFC = io.loadmat('/Users/veronikasamborska/Desktop/PFC.mat') return data_HP, data_PFC,experiment_aligned_PFC,experiment_aligned_HP
def import_data(): ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' HP, PFC, m484, m479, m483, m478, m486, m480, m481, all_sessions = ep.import_code( ephys_path, beh_path, lfp_analyse='False') HP = io.loadmat('/Users/veronikasamborska/Desktop/HP.mat') PFC = io.loadmat('/Users/veronikasamborska/Desktop/PFC.mat') Data_HP = HP['Data'][0] DM_HP = HP['DM'][0] Data_PFC = PFC['Data'][0] DM_PFC = PFC['DM'][0]
def import_data(): ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' HP_LFP,PFC_LFP, m484_LFP, m479_LFP, m483_LFP, m478_LFP, m486_LFP, m480_LFP, m481_LFP, all_sessions_LFP = ep.import_code(ephys_path,beh_path, lfp_analyse = 'True') HP = scipy.io.loadmat('/Users/veronikasamborska/Desktop/HP.mat') PFC = scipy.io.loadmat('/Users/veronikasamborska/Desktop/PFC.mat') Data_HP = HP['Data'][0] DM_HP = HP['DM'][0] Data_PFC = PFC['Data'][0] DM_PFC = PFC['DM'][0]
def import_data(): ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' # HP = scipy.io.loadmat('/Users/veronikasamborska/Desktop/HP.mat') # HP = m484 + m479 + m483 HP_LFP,PFC_LFP, m484_LFP, m479_LFP, m483_LFP, m478_LFP, m486_LFP, m480_LFP, m481_LFP, all_sessions_LFP = ep.import_code(ephys_path,beh_path, lfp_analyse = 'True') all_times_m484_LFP, filtered_LFP_m484_LFP, peak_power_all_m484 = ripple_detect(m484_LFP) all_times_m483_LFP, filtered_LFP_m483_LFP, peak_power_all_m483 = ripple_detect(m483_LFP) HP = scipy.io.loadmat('/Users/veronikasamborska/Desktop/HP.mat') PFC = scipy.io.loadmat('/Users/veronikasamborska/Desktop/PFC.mat') Data_HP = HP['Data'][0] DM_HP = HP['DM'][0] Data_PFC = PFC['Data'][0] DM_PFC = PFC['DM'][0] all_sessions_1, all_sessions_2, all_sessions_3 = ripple_plot(peak_power_all_m484, m484_LFP,HP)
def stats_svd(data_loaded=True, d=True): if data_loaded == False: ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' HP, PFC, m484, m479, m483, m478, m486, m480, m481, all_sessions = ep.import_code( ephys_path, beh_path, lfp_analyse='False') experiment_aligned_m484 = ha.all_sessions_aligment(m484, all_sessions) experiment_aligned_m479 = ha.all_sessions_aligment(m479, all_sessions) experiment_aligned_m483 = ha.all_sessions_aligment(m483, all_sessions) experiment_aligned_m478 = ha.all_sessions_aligment(m478, all_sessions) experiment_aligned_m486 = ha.all_sessions_aligment(m486, all_sessions) experiment_aligned_m480 = ha.all_sessions_aligment(m480, all_sessions) experiment_aligned_m481 = ha.all_sessions_aligment(m481, all_sessions) #average_within_HP, average_between_HP = sv.svd_plotting(experiment_aligned_HP, tasks_unchanged = True, plot_a = False, plot_b = False, HP = True, average_reward = False, diagonal = True, demean_all_tasks = False) average_within_m484, average_between_m484 = sv.svd_plotting( experiment_aligned_m484, tasks_unchanged=False, plot_a=True, plot_b=False, HP=True, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m479, average_between_m479 = sv.svd_plotting( experiment_aligned_m479, tasks_unchanged=False, plot_a=True, plot_b=False, HP=True, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m483, average_between_m483 = sv.svd_plotting( experiment_aligned_m483, tasks_unchanged=False, plot_a=True, plot_b=False, HP=True, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m478, average_between_m478 = sv.svd_plotting( experiment_aligned_m478, tasks_unchanged=False, plot_a=True, plot_b=False, HP=False, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m481, average_between_m481 = sv.svd_plotting( experiment_aligned_m481, tasks_unchanged=False, plot_a=True, plot_b=False, HP=False, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m486, average_between_m486 = sv.svd_plotting( experiment_aligned_m486, tasks_unchanged=False, plot_a=True, plot_b=False, HP=False, average_reward=False, diagonal=d, demean_all_tasks=False) average_within_m480, average_between_m480 = sv.svd_plotting( experiment_aligned_m480, tasks_unchanged=False, plot_a=True, plot_b=False, HP=False, average_reward=False, diagonal=d, demean_all_tasks=False) first, average_between_m484, average_between_y_m484, average_within_x_m484, average_within_m484 = svdu.svd_u_and_v_separately( experiment_aligned_m484, tasks_unchanged=True, plot_a=False, plot_b=False, HP=True, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m479, average_between_y_m479, average_within_x_m479, average_within_m479 = svdu.svd_u_and_v_separately( experiment_aligned_m479, tasks_unchanged=True, plot_a=False, plot_b=False, HP=True, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m483, average_between_y_m483, average_within_x_m483, average_within_m483 = svdu.svd_u_and_v_separately( experiment_aligned_m483, tasks_unchanged=True, plot_a=False, plot_b=False, HP=True, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m478, average_between_y_m478, average_within_x_m478, average_within_m478 = svdu.svd_u_and_v_separately( experiment_aligned_m478, tasks_unchanged=True, plot_a=False, plot_b=False, HP=False, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m481, average_between_y_m481, average_within_x_m481, average_within_m481 = svdu.svd_u_and_v_separately( experiment_aligned_m481, tasks_unchanged=True, plot_a=False, plot_b=False, HP=False, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m486, average_between_y_m486, average_within_x_m486, average_within_m486 = svdu.svd_u_and_v_separately( experiment_aligned_m486, tasks_unchanged=True, plot_a=False, plot_b=False, HP=False, average_reward=False, demean_all_tasks=False, z_score=False) first, average_between_m480, average_between_y_m480, average_within_x_m480, average_within_m480 = svdu.svd_u_and_v_separately( experiment_aligned_m480, tasks_unchanged=True, plot_a=False, plot_b=False, HP=False, average_reward=False, demean_all_tasks=False, z_score=False) m484 = (np.trapz(average_within_m484) - np.trapz(average_between_y_m484)) / average_within_m484.shape[0] m479 = (np.trapz(average_within_m479) - np.trapz(average_between_y_m479)) / average_within_m479.shape[0] m483 = (np.trapz(average_within_m483) - np.trapz(average_between_y_m483)) / average_within_m483.shape[0] HP_area = [m484, m479, m483] m478 = (np.trapz(average_within_m478) - np.trapz(average_between_y_m478)) / average_within_m478.shape[0] m481 = (np.trapz(average_within_m481) - np.trapz(average_between_y_m481)) / average_within_m481.shape[0] m486 = (np.trapz(average_within_m486) - np.trapz(average_between_y_m486)) / average_within_m486.shape[0] m480 = (np.trapz(average_within_m480) - np.trapz(average_between_y_m480)) / average_within_m480.shape[0] PFC_area = [m478, m481, m486, m480] s = stats.ttest_ind(PFC_area, HP_area) plt.figure() sns.barplot(data=[HP_area, PFC_area], capsize=.1, ci="sd", palette="Blues_d") return HP_area, PFC_area, s
'/Users/veronikasamborska/Desktop/ephys_beh_analysis/regressions') sys.path.append( '/Users/veronikasamborska/Desktop/ephys_beh_analysis/modelling') import scipy.io import pylab as plt import heatmap_aligned as ha import RW_model_fitting as mfit import create_data_arrays_for_tim as cda import forced_trials_extract_data as ft import ephys_beh_import as ep import numpy as np ephys_path = '/Users/veronikasamborska/Desktop/neurons' beh_path = '/Users/veronikasamborska/Desktop/data_3_tasks_ephys' HP, PFC, m484, m479, m483, m478, m486, m480, m481, all_sessions = ep.import_code( ephys_path, beh_path, lfp_analyse='False') experiment_aligned_PFC = ha.all_sessions_aligment(PFC, all_sessions) experiment_aligned_HP = ha.all_sessions_aligment(HP, all_sessions) #PFC_forced = ft.all_sessions_aligment_forced(PFC,all_sessions) #HP_forced = ft.all_sessions_aligment_forced(HP,all_sessions) # experiment_sim_Q1_HP, experiment_sim_Q4_HP, experiment_sim_Q1_value_a_HP ,experiment_sim_Q1_value_b_HP, experiment_sim_Q4_values_HP,\ # experiment_sim_Q1_PFC, experiment_sim_Q4_PFC, experiment_sim_Q1_value_a_PFC, experiment_sim_Q1_value_b_PFC, experiment_sim_Q4_values_PFC = mfit.run(experiment_aligned_HP,experiment_aligned_PFC) # data_PFC = cda.tim_create_mat(experiment_aligned_PFC,experiment_sim_Q1_PFC, experiment_sim_Q4_PFC, experiment_sim_Q1_value_a_PFC, experiment_sim_Q1_value_b_PFC, experiment_sim_Q4_values_PFC, 'PFC_RPE') # data_HP = cda.tim_create_mat(experiment_aligned_HP, experiment_sim_Q1_HP, experiment_sim_Q4_HP, experiment_sim_Q1_value_a_HP, experiment_sim_Q1_value_b_HP, experiment_sim_Q4_values_HP, 'HP_RPE') #data_PFC = cda.tim_create_mat(experiment_aligned_PFC,'PFC') #data_HP = cda.tim_create_mat(experiment_aligned_HP, 'HP')