%% td = []; td2 = []; preDist_1 = []; preDist_2 = []; postDist_1 = []; postDist_2 = []; evalDist = []; totalDist = []; occuF = []; occuR = []; %% fwdlrn = [flyStruct.forwardLrn]; revlrn = [flyStruct.reverseLrn]; [lrnFWD,dist,occuF] = lrnScoreUpdate(fwdlrn); preDist_1 = dist(:,1); postDist_1 = dist(:,2); [lrnREV,dist,occuR] = lrnScoreUpdate(revlrn); preDist_1 = dist(:,1); postDist_1 = dist(:,2); %% ind = isnan(lrnFWD) | isnan(lrnREV); %% PCARegressionCI([lrnFWD(~ind)',lrnREV(~ind)']); axis([-1 1 -1 1]); xlabel('Learning metric trial 1: CS+ MCH') ylabel('Learning metric trial 2: CS+ OCT') [a1,b1] = corrcoef(lrnFWD(~ind),lrnREV(~ind),'rows','pairwise'); temp1 = strcat({'r = '},num2str(round(a1(2),2))); temp2 = strcat({'p = '},num2str(round(b1(2),2))); a2 = text(-0.85,0.85,temp1);a2.FontSize = 14; a2 = text(-0.85,0.75,temp2);a2.FontSize = 14; cleanFormat a = title('Correlation of learning and reversal learning'); %% Adding points of example flies hold on temp = [lrnFWD(~ind)',lrnREV(~ind)']; sp1 = find(temp(:,1) == lrnFWD(3)); ex1 = [1-occuF(3,:),1-occuR(3,:)]; sp2 = find(temp(:,2) == lrnREV(17)); ex2 = [1-occuF(17,:),1-occuR(17,:)]; sp3 = find(temp(:,1) == lrnFWD(20)); ex3 = [1-occuF(20,:),1-occuR(20,:)]; temp = temp([sp1,sp2,sp3],:); a = scatter(temp(1,1),temp(1,2));a.MarkerFaceColor = [0.88 0.8 0.4];a.MarkerEdgeColor = [0 0 0];a.MarkerFaceAlpha = 1;a.SizeData = 75; a = scatter(temp(2,1),temp(2,2));a.MarkerFaceColor = [0.25 0.25 0.9];a.MarkerEdgeColor = [0 0 0];a.MarkerFaceAlpha = 1;a.SizeData = 75; a = scatter(temp(3,1),temp(3,2));a.MarkerFaceColor = [0.85 0.3 0.3];a.MarkerEdgeColor = [0 0 0];a.MarkerFaceAlpha = 1;a.SizeData = 75; %% PCARegressionCI([postDist_1(~ind),lrnFWD(~ind)']); xlabel('Learning metric trial 1: CS+ MCH') ylabel('Learning metric trial 2: CS+ OCT') [a1,b1] = corrcoef(postDist_1(~ind),lrnFWD(~ind),'rows','pairwise'); temp1 = strcat({'r = '},num2str(round(a1(2),2))); temp2 = strcat({'p = '},num2str(round(b1(2),2))); a2 = text(-0.85,0.85,temp1);a2.FontSize = 14; a2 = text(-0.85,0.75,temp2);a2.FontSize = 14; cleanFormat a = title('Correlation of distance traveled and learning score');a.FontWeight = 'normal'; %% pre = occuF(:,1)'; mattCorr(pre(~ind)',lrnFWD(~ind)'); axis([0 1 -1 1]) xlabel('Learning metric trial 1: CS+ MCH') ylabel('Learning metric trial 2: CS+ OCT') [a1,b1] = corrcoef(pre(~ind),lrnFWD(~ind),'rows','pairwise'); temp1 = strcat({'r = '},num2str(round(a1(2),2))); temp2 = strcat({'p = '},num2str(round(b1(2),2))); a2 = text(-0.85,0.85,temp1);a2.FontSize = 14; a2 = text(-0.85,0.75,temp2);a2.FontSize = 14; cleanFormat a = title('Relationship of intial odor preference and learning score');a.FontWeight = 'normal'; %% lrnGraphOld(1-occuF(:,1),1-occuF(:,2)) cleanFormat ylabel('Octanol preference') a = title('Shock pre-training vs post-training'); a.FontWeight = 'normal'; temp = 1-occuF(ind,:); hold on a2 = plot([0,1],[ex1(1),ex1(2)]);a2.LineWidth = 6;a2.Color = [0.88 0.8 0.4];a2.Marker = '.';a2.MarkerSize = 25; a2 = plot([0,1],[ex2(1),ex2(2)]);a2.LineWidth = 6;a2.Color = [0.25 0.25 0.9];a2.Marker = '.';a2.MarkerSize = 25; a2 = plot([0,1],[[ex3(1),ex3(2)]]);a2.LineWidth = 6;a2.Color = [0.85 0.3 0.3];a2.Marker = '.';a2.MarkerSize = 25; %~~~~~~ Adding mean trend line a = plot([0,1],[nanmean(1-occuF(ind,1)),nanmean(1-occuF(ind,2))],'Color',[0.2 0.8 0.5]); a.LineWidth = 4; a.Marker = '.'; a.MarkerSize = 25; a1 = axis;a1(4) = 1.2;axis(a1) a = plot([0,1],[1.1,1.1]);a.LineWidth = 1;a.Color = [0,0,0]; a = plot([0,0],[1.1,1.075]);a.LineWidth = 1;a.Color = [0,0,0]; a = plot([1,1],[1.1,1.075]);a.LineWidth = 1;a.Color = [0,0,0]; %~~~~~~~~~~~~~~~~~~~~ %% mattbar_norm({1-occuF(:,1)',1-occuF(:,2)'}) a1 = axis;a1(3) = 0;a1(4) = 1; axis(a1) xticks([1,2]) xticklabels({'pre-training','post-training'}) %% adding bar graphs lrnGraph(1-occuR(:,1),1-occuR(:,2)) cleanFormat ylabel('Octanol preference') a = title('Shock pre-training vs post-training'); a.FontWeight = 'normal'; temp = 1-occuR(ind,:); hold on a2 = plot([0,1],[ex1(3),ex1(4)]);a2.LineWidth = 6;a2.Color = [0.88 0.8 0.4];a2.Marker = '.';a2.MarkerSize = 25; a2 = plot([0,1],[ex2(3),ex2(4)]);a2.LineWidth = 6;a2.Color = [0.25 0.25 0.9];a2.Marker = '.';a2.MarkerSize = 25; a2 = plot([0,1],[[ex3(3),ex3(4)]]);a2.LineWidth = 6;a2.Color = [0.85 0.3 0.3];a2.Marker = '.';a2.MarkerSize = 25; %~~~~~~ Adding mean trend line a = plot([0,1],[nanmean(1-occuR(:,1)),nanmean(1-occuR(:,2))],'Color',[0.2 0.8 0.5]); a.LineWidth = 4; a.Marker = '.'; a.MarkerSize = 25; a1 = axis;a1(4) = 1.2;axis(a1) a = plot([0,1],[1.1,1.1]);a.LineWidth = 1;a.Color = [0,0,0]; a = plot([0,0],[1.1,1.075]);a.LineWidth = 1;a.Color = [0,0,0]; a = plot([1,1],[1.1,1.075]);a.LineWidth = 1;a.Color = [0,0,0]; %~~~~~~~~~~~~~~~~~~~~ mattbar_norm({1-occuR(:,1)',1-occuR(:,2)'}) a1 = axis;a1(3) = 0;a1(4) = 1; axis(a1) xticks([1,2]) xticklabels({'pre-training','post-training'})