-
Notifications
You must be signed in to change notification settings - Fork 0
/
A011_lateral_medial_plots_FINAL.m
184 lines (168 loc) · 7.72 KB
/
A011_lateral_medial_plots_FINAL.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
% plot elecs medial to lateral for indiv animals
% steps: run A001, then run this, saves output matrix and figure, then generate group plots
%%
per = 1;
tickmarks = 1:30:length(freq);
[ anterolat_postermedial] = ca1_electodes( anim, chan_length )
direc_chan = anterolat_postermedial;
ca1_elec_lanim_1_response_timesanim_1_response_timesength = 4;
cd('D:\Gattas\ephys_data_final\group_plots')
% plot inseq correct
mx = 1
mn = -1
i = 1;
figure
if strcmp('inseq_outseq_exp', trial_selection) || strcmp('inseqcorr_inseqincorr', trial_selection) || strcmp('otseqcorr_otseqincorr', trial_selection)
for elec = direc_chan
subplot(2,length(direc_chan),i)
if strcmp('p_i', lock)
imagesc(linspace(eventWindow(1)+.0017,eventWindow(2)-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_inseq(:,101:end-100,elec))
elseif strcmp('p_o', lock)
imagesc(linspace(eventWindow(1)+.0017,eventWindow(2)-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_inseq(:,101:end-100,elec))
end
colorbar
caxis([mn per*mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec)) ' iseq +' ])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1;
end
%% plot outseq correct
for elec = direc_chan
subplot(2,length(direc_chan),i)
if strcmp('p_i', lock)
imagesc(linspace(eventWindow(1)+.0017,eventWindow(2)-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_outseq(:,101:end-100,elec))
elseif strcmp('p_o', lock)
imagesc(linspace(eventWindow(1)+.0017,eventWindow(2)-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_outseq(:,101:end-100,elec))
end
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
colorbar
caxis([mn per*mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec)) ' outseq +' ])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1;
end
set(gca, 'FontSize', 8, 'FontWeight', 'bold')
if strcmp('p_i',lock)
fig_nam = ['Animal_' num2str(anim) '_lateral_to_media_Channels_' fignam '_POKE_IN.png']
else
fig_nam = ['Animal_' num2str(anim) '_lateral_to_media_Channels_' fignam '_POKE_OUT.png']
end
saveas(gcf,fig_nam)
%% plot inseq incorrect
elseif strcmp('inseq_outseq_con', trial_selection)
i = 1;
% figure
for elec = direc_chan
subplot(2,length(direc_chan),i)
if strcmp('p_i', lock)
imagesc(linspace(-.5+.0017,minimum_RT_outseq-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_inseq(:,:,elec))
elseif strcmp('p_o', lock)
imagesc(linspace(-1+.0017,1-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_inseq(:,:,elec))
end
colorbar
caxis([mn per*mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec)) ])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1
end
%% plot outseq INcorrect
for elec = direc_chan
subplot(2,length(direc_chan),i)
if strcmp('p_i', lock)
imagesc(linspace(-.5+.0017,minimum_RT_outseq-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_outseq(:,:,elec))
elseif strcmp('p_o', lock)
imagesc(linspace(-1+.0017,1-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_outseq(:,:,elec))
end
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
colorbar
caxis([mn per*mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec)) ])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1;
end
set(gca, 'FontSize', 8, 'FontWeight', 'bold')
if strcmp('p_i',lock)
fig_nam = ['Animal_' num2str(anim) '_lateral_to_media_Channels_' fignam '_POKE_IN.png']
else
fig_nam = ['Animal_' num2str(anim) '_lateral_to_media_Channels_' fignam '_POKE_OUT.png']
end
saveas(gcf,fig_nam)
%%insep corr - outseq incorr
elseif strcmp('inseqcorr_otseqincorr', trial_selection)
for elec = direc_chan
subplot(1,length(direc_chan),i)
imagesc(linspace(-1+.0017,1-.0017,size(indiv_freq_inseq_trls_chans,2)), 1:length(freq), mn_acrs_trials_inseq(:,:,elec)- mn_acrs_trials_outseq(:,:,elec))
colorbar
colormap jet
% caxis([mn per*mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec)) ])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1;
end
cd('C:\Users\FortinLab\Desktop\Example Data Sets\welltrained_group_data')
cond1= mn_acrs_trials_inseq(:, :, direc_chan)-mn_acrs_trials_outseq(:, :, direc_chan);
filename= ['anim' num2str(anim) '_AL_PM_' trial_selection '_' lock '_matched_trials_DiffRT'];
save(filename, 'cond1')
% running spectrogram
elseif strcmp('run', trial_selection)
% freq_range= freq<36;
%new_freq = freq(freq_range);
% tickmarks =1:15:length(new_freq);
for elec = direc_chan
subplot(1,length(direc_chan),i)
imagesc(linspace(-.5+.0017,.5-.0017,size(mn_acrs_trials_run,2)), 1:length(freq), mn_acrs_trials_run(:,101:end-100,elec))
colorbar
colormap jet
caxis([mn mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec))])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
i = i+1;
end
end
%% save figures along axis
cd('D:\Gattas\ephys_data_final\group_plots\paper_figure_material_pool_trials_and_indiv_anim\fig2_runVsOdor')
hgexport(gcf, ['anim' num2str(anim) '_AL_PM_' trial_selection '.jpg'], hgexport('factorystyle'), 'Format', 'jpeg')
hgexport(gcf, ['anim' num2str(anim) '_AL_PM_' trial_selection '.eps'], hgexport('factorystyle'), 'Format', 'eps')
%% save figures one at a time
i = 0;
for elec = direc_chan
figure
i = i+1;
imagesc(linspace(-.5+.0017,.5-.0017,size(mn_acrs_trials_run,2)), 1:length(freq), mn_acrs_trials_run(:,101:end-100,elec))
colorbar
colormap jet
caxis([mn mx])
hold on
plot(zeros(1,length(freq)), 1:length(freq),'Color','k','LineWidth',1)
title (['chan ' num2str(chan_length(elec))])
set(gca, 'YTick',tickmarks,'YTickLabel',round(freq(tickmarks)))
hgexport(gcf, ['anim' num2str(anim) '_AL_PM_' trial_selection '_elec_' num2str(i) '.jpg'], hgexport('factorystyle'), 'Format', 'jpeg')
hgexport(gcf, ['anim' num2str(anim) '_AL_PM_' trial_selection '_elec_' num2str(i) '.eps'], hgexport('factorystyle'), 'Format', 'eps')
end
%% save data
if strcmp('run', trial_selection)
cond1 = mn_acrs_trials_run(:, :, direc_chan);
filename= ['anim' num2str(anim) '_AL_PM_' trial_selection];
save(filename, 'cond1')
else
cond1 = mn_acrs_trials_inseq(:, :, direc_chan);
cond2 = mn_acrs_trials_outseq(:, :, direc_chan);
if strcmp('yes',match)
filename= ['anim' num2str(anim) '_AL_PM_' trial_selection '_' lock '_matched_trials_' task];
else
filename= ['anim' num2str(anim) '_AL_PM_' trial_selection '_' lock '_nonmatched_trials_' task];
end
save(filename, 'cond1', 'cond2')
end