Late_sessions_average_US_err = np.zeros((2,1)) Rats_early_averageCS = np.zeros((n_rats,2)) Rats_late_averageCS = np.zeros((n_rats,2)) Rats_early_averageUS = np.zeros((n_rats,2)) Rats_late_averageUS = np.zeros((n_rats,2)) for iti, u_iti in enumerate(u_itis): filename = 'Variable ITIs/' + Distribution_name + ' distribution/Mixed population simulations with intertrial ' + str(iti) + '.npz' data = np.load(filename) plt.figure(1) IndividualAverageDA_CS = np.mean(data['dopamineCS'], axis = 0) Session_Average_DA_CS = np.mean(IndividualAverageDA_CS, axis = 1) Session_Average_DA_CS_err = sem(IndividualAverageDA_CS.transpose()) plt.errorbar(x, Session_Average_DA_CS, Session_Average_DA_CS_err, label=ITI_labels[iti], color=ITI_colours[iti], marker = 'o') Rats_SessionAverage_DA_CS = np.mean(IndividualAverageDA_CS, axis = 0) All_session_average_CS[iti] = np.mean(Rats_SessionAverage_DA_CS) All_session_average_CS_err[iti] =sem(Rats_SessionAverage_DA_CS) for rat in range(n_rats): Rats_early_averageCS[rat,iti] = np.mean(IndividualAverageDA_CS[0:3,rat]) Rats_late_averageCS[rat,iti] = np.mean(IndividualAverageDA_CS[3:,rat]) Early_sessions_average_CS[iti] = np.mean(Rats_early_averageCS[:,iti]) Early_sessions_average_CS_err[iti] = sem(Rats_early_averageCS[:,iti]) Late_sessions_average_CS[iti] = np.mean(Rats_late_averageCS[:,iti]) Late_sessions_average_CS_err[iti] = sem(Rats_late_averageCS[:,iti])
u_itis = np.array([0.01, 0.1]) n_blocks = 60 n_trials = 25 x = range(1, n_blocks + 1) for iti, u_iti in enumerate(u_itis): filename = 'Variable ITIs/' + Distribution_name + ' distribution/Mixed population long simulations with intertrial ' + str( iti) + '.npz' data = np.load(filename) a = data['state1_FMFValue'] V_L = np.mean(a[:, 1, :], axis=1).reshape((n_blocks, n_trials)).transpose() V_M = np.mean(a[:, 2, :], axis=1) plt.figure(iti) yerr = sem(V_L).transpose() y = np.mean(V_L, axis=0) plt.errorbar(x, np.mean(V_L, axis=0), color=ITI_colours[iti], marker='o', label='Lever') plt.errorbar(x, np.mean(V_M, axis=0), color=ITI_colours[iti], marker='+', label='Food cup') plt.legend() plt.savefig('Variable ITIs/' + Distribution_name + ' distribution/' + ITI_labels[iti] + ' feature values.eps')
#filename = ITIcondition + '/' + phenotype + 'Simulations with intertrial ' + str(iti_scale) + '.npz' filename = 'replication Lesaint 2014/' + phenotype + 'Simulations with intertrial ' + str( iti_scale) + '.npz' #filename = 'magazine ' + magazine + '/' + phenotype + 'Simulations.npz' #filename = phenotype + 'Simulations.npz' data = np.load(filename) plt.figure(counter) plt.plot(x, data['goL_counter'].transpose() / n_trials) plt.figure(counter + n_phenotypes) plt.plot(x, data['goM_counter'].transpose() / n_trials) plt.figure(10) y = np.mean(data['goL_counter'] / n_trials, axis=0) yerr = sem(data['goL_counter'] / n_trials) plt.errorbar(x, y, yerr, color=pheno_colours[counter], label=phenotype) plt.figure(11) y = np.mean(data['goM_counter'] / n_trials, axis=0) yerr = sem(data['goM_counter'] / n_trials) plt.errorbar(x, y, yerr, color=pheno_colours[counter], label=phenotype) plt.figure(10) plt.axis([0, 9, 0, 1]) plt.savefig('replication Lesaint 2014/' + 'Approach to lever when ' + ITIcondition + ' during ' + duration + ' ITI.png') plt.legend(loc='best') plt.figure(11) plt.axis([0, 9, 0, 1]) plt.savefig('replication Lesaint 2014/' + 'Approach to magazine when ' +
AverageDistribution_err = np.zeros((3,3)) AverageFMFvalues = np.zeros((3,3)) AverageFMFvalues_err = np.zeros((3,3)) AverageAdvantage = np.zeros((3,3)) AverageAdvantage_err = np.zeros((3,3)) for iti, u_iti in enumerate(u_itis): filename = 'Variable ITIs/' + Distribution_name + ' distribution/Mixed population long simulations with intertrial ' + str(iti) + '.npz' data = np.load(filename) sio.savemat('goL_counter for ' + ITI_labels[iti] + ' ITI', {'goL': data['goL_counter']}) sio.savemat('goM_counter for ' + ITI_labels[iti] + ' ITI', {'goM': data['goM_counter']}) plt.figure(1) y = np.mean(data['goL_counter'] / n_trials, axis = 0) yerr = sem(data['goL_counter'] / n_trials) plt.errorbar(x, y, yerr, label=ITI_labels[iti], color=ITI_colours[iti], marker = 'o') plt.figure(2) y = np.mean(data['goM_counter'] / n_trials, axis = 0) yerr = sem(data['goM_counter'] / n_trials) plt.errorbar(x, y, yerr, label=ITI_labels[iti], color=ITI_colours[iti], marker = 'o') plt.figure(3) IndividualAverageDA_CS = np.mean(data['dopamineCS'], axis = 0) y = np.mean(IndividualAverageDA_CS, axis = 1) yerr = sem(IndividualAverageDA_CS.transpose()) plt.errorbar(x, y, yerr, label=ITI_labels[iti], color=ITI_colours[iti], marker = 'o') plt.figure(4) IndividualAverageDA_US = np.mean(data['dopamineUS'], axis = 0)
ITIcondition = 'magazine absent' elif lever_present: ITIcondition = 'lever present' else: ITIcondition = 'lever absent' print(ITIcondition) for counter, phenotype in enumerate(phenotypes): #filename = ITIcondition + '/' + phenotype + 'Simulations with intertrial ' + str(iti_scale) + '.npz' filename = 'replication Lesaint 2014/' + phenotype + 'Simulations with intertrial ' + str(iti_scale) + '.npz' data = np.load(filename) plt.figure() IndividualAverageDA_CS = np.mean(data['dopamineCS'], axis = 0) plt.plot(x, IndividualAverageDA_CS) plt.figure() IndividualAverageDA_US = np.mean(data['dopamineUS'], axis = 0) plt.plot(x, IndividualAverageDA_US) plt.figure() y = np.mean(IndividualAverageDA_CS, axis = 1) yerr = sem(IndividualAverageDA_CS.transpose()) plt.errorbar(x, y, yerr, color='r', label='CS') y = np.mean(IndividualAverageDA_US, axis = 1) yerr = sem(IndividualAverageDA_US.transpose()) plt.errorbar(x, y, yerr, color='b', label='US') plt.axis([0, 9, 0, 1]) plt.legend(loc='best') plt.savefig('replication Lesaint 2014//Patterns of Da activity in ' + phenotype + ' for ' + duration + ' intertrial ' + ITIcondition + '.pdf') plt.show()
iti_scales = [0.5, 1, 2] print(iti_scales) n_blocks = 8 n_trials = 50 x = range(1, n_blocks + 1) for counter, iti_scale in enumerate(iti_scales): filename = ITIcondition + '/' + phenotype + 'Simulations with intertrial ' + str( iti_scale) + '.npz' #filename = phenotype + 'Simulations.npz' data = np.load(filename) plt.figure(1) y = np.mean(data['goL_counter'] / n_trials, axis=0) yerr = sem(data['goL_counter'] / n_trials) plt.errorbar(x, y, yerr, label='u_iti=' + str(iti_scale)) #, color=pheno_colours[counter] plt.figure(2) y = np.mean(data['goM_counter'] / n_trials, axis=0) yerr = sem(data['goM_counter'] / n_trials) plt.errorbar(x, y, yerr, label='u_iti=' + str(iti_scale)) #, color=pheno_colours[counter] plt.figure(3) IndividualAverageDA_CS = np.mean(data['dopamineCS'], axis=0) y = np.mean(IndividualAverageDA_CS, axis=1) yerr = sem(IndividualAverageDA_CS.transpose()) plt.errorbar(x, y, yerr, label='u_iti=' + str(iti_scale))
import numpy as np import matplotlib.pyplot as plt from SEM import sem phenotype = ['ST'] iti_scales = 1 n_blocks = 8 n_trials = 50 x = range(1, 3) filename = phenotype[0] + 'Simulations with intertrial ' + str(iti_scales) + '.npz' data = np.load(filename) a = np.mean(data['goL_counter1'] / n_trials, axis = 0) a_err = sem(data['goL_counter1'] / n_trials) b = np.mean(data['goL_counter2'] / n_trials, axis = 0) b_err = sem(data['goL_counter2'] / n_trials) y1 = np.stack((a, b), axis = 1) y1_err = np.stack((a_err, b_err), axis = 1) a = np.mean(data['goM_counter1'] / n_trials, axis = 0) a_err = sem(data['goM_counter1'] / n_trials) b = np.mean(data['goM_counter2'] / n_trials, axis = 0) b_err = sem(data['goM_counter2'] / n_trials) y2 = np.stack((a, b), axis = 1) y2_err = np.stack((a_err, b_err), axis = 1) a = np.mean(data['exp_counter1'] / n_trials, axis = 0) a_err = sem(data['exp_counter1'] / n_trials) b = np.mean(data['exp_counter2'] / n_trials, axis = 0)
width = 0.2 epsilon = 0.1 x = [1 - (width + epsilon) / 2, 1 + (width + epsilon) / 2] filename = Distribution_name + '/Simulations with intertrial ' + str( u_iti) + '.npz' data = np.load(filename) a = np.mean(data['goL_counter1'] / n_trials, axis=1) b = np.mean(data['goL_counter2'] / n_trials, axis=1) y1 = np.stack((a, b), axis=1) a = np.mean(data['goM_counter1'] / n_trials, axis=1) b = np.mean(data['goM_counter2'] / n_trials, axis=1) y2 = np.stack((a, b), axis=1) y2err = sem(y2) #plt.figure(2) #plt.boxplot(y2) #plt.plot(x, np.mean(y2, axis = 0), color = 'black') #for rat in range(n_rats): # plt.figure(1) # plt.plot(x, y1[rat,:], color = 'lightgray') # # plt.figure(2) # plt.plot(x, y2[rat,:], color = 'lightgray', marker = '.') # #t_goL, p_goL = stats.ttest_rel(y1[:,0], y1[:,1]) #t_goM, p_goM = stats.ttest_rel(y2[:,0], y2[:,1])
import numpy as np import matplotlib.pyplot as plt from SEM import sem u_iti = 0.8 n_blocks = 8 n_trials = 50 x = range(1, 3) #filename = phenotype[0] + 'FMFonly_Simulations with intertrial ' + str(u_iti) + '.npz' filename = 'Decaying MB Simulations.npz' data = np.load(filename) a = np.mean(data['goL_counter1'] / n_trials, axis=0) a_err = sem(data['goL_counter1'] / n_trials) b = np.mean(data['goL_counter2'] / (data['goL_counter2'] + data['goM_counter2']), axis=0) b_err = sem(data['goL_counter2'] / (data['goL_counter2'] + data['goM_counter2'])) y1 = np.stack((a, b), axis=1) y1_err = np.stack((a_err, b_err), axis=1) a = np.mean(data['goM_counter1'] / n_trials, axis=0) a_err = sem(data['goM_counter1'] / n_trials) b = np.mean(data['goM_counter2'] / (data['goL_counter2'] + data['goM_counter2']), axis=0) b_err = sem(data['goM_counter2'] / (data['goL_counter2'] + data['goM_counter2']))
elif lever_present: ITIcondition = 'lever present' else: ITIcondition = 'lever absent' print(ITIcondition) #filename = 'flupenthixol inhibition/ST flupenthixol inhibition = ' + str(flupenthixol) + '.npz' filename = 'replication Lesaint 2014/ST flupenthixol inhibition = ' + str(flupenthixol) + '.npz' data_flu = np.load(filename) filename = 'replication Lesaint 2014/STSimulations with intertrial ' + str(iti_scale) + '.npz' data_control = np.load(filename) plt.figure() y1 = np.mean(data_flu['goL_counter'] / n_trials, axis = 0) y1err = sem(data_flu['goL_counter'] / n_trials) plt.errorbar(x, y1[0:7], y1err[0:7], color='r', label='flu') y2 = np.mean(data_control['goL_counter'] / n_trials, axis = 0) y2err = sem(data_control['goL_counter'] / n_trials) plt.errorbar(x, y2[0:7], y2err[0:7], color='k', label='veh') plt.axis([0, 9, 0, 1]) plt.legend(loc='best') plt.savefig('replication Lesaint 2014/ST Approach to lever under flupenthixol treatment.png') plt.figure() plt.bar([7.75, 8.25], [y2[7], y1[7]], align='center', width = 0.4, yerr = [y2err[7], y1err[7]], color=['k', 'r']) plt.savefig('replication Lesaint 2014/ST Approach to lever after flupenthixol treatment.png') filename = 'replication Lesaint 2014/GT flupenthixol inhibition = ' + str(flupenthixol) + '.npz' data_flu = np.load(filename)