forked from simonweiler/LGN_Aanalysis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquick_load.m
201 lines (179 loc) · 5.9 KB
/
quick_load.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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
%%
concatenate_ramp_display==1
display_ramp=0
if display_ramp==0
tr=19;
iter=4;
pulse=4;
base_start = 1;
base_end = 99;
pulse_start = 100;
pulse_end = 110;
redpeak_start = 100;
redpeak_end = 349;
bluepeak_start = 351;
bluepeak_end = 400;
raw_traces=data{tr,5}.ephys_traces(:,iter,pulse);
cutoff = 1000; % Hz (use 500 Hz for mini event / amplitude detection and 1000Hz for max currents. Chen & Regehr 2000)
order = 4; % filter order ('pole'). (use 4 pole for minis and max current. Chen & Regehr 2000)
type = 'Butter';
sr=10000;
srF=10;
filt_traces = lowpassfilt(raw_traces, order, cutoff, sr, type);
figure;
%set(gcf, 'Position', [200, 0, 1000, 500]);
plot(filt_traces(1:10000,:),'Color','k');
%hold on;plot(data{tr,5}.ephys_traces(1:10000,8:11,4)+50,'Color','k');
hold on;
y1=get(gca,'ylim');
x1= redpeak_start*srF;
hold on;
p1=plot([x1 x1],y1,'--','Color','r');
p1.Color(4) = 1;
hold on;
y1=get(gca,'ylim');
x1=redpeak_end*srF;
hold on;
p2=plot([x1 x1],y1,'--','Color','b');
p2.Color(4) = 1;
hold on;
% y1=get(gca,'ylim');
% x1=bluepeak_start*srF;
% hold on;
% p3=plot([x1 x1],y1,'--','Color','b');
% p3.Color(4) = 0.3;
% hold on;
y1=get(gca,'ylim');
x1=bluepeak_end *srF;
hold on;
p4=plot([x1 x1],y1,'--','Color','b');
p4.Color(4) = 1;
xlabel('Time (ms)');
ylabel('Synaptic input (pA)');
set(gca,'YTick',[-2000:500:500]);
set(gca,'XTick',[1000:2000:10000],'XTickLabel',{'100','300','500','700','900','1000'});
set(gca,'FontSize',15);
set(gca, 'box', 'off');
if pulse==3 | pulse==4
legend('NMDA');
legend boxoff;
text(7000, min(filt_traces(1:10000,:))-10, ['irradiance red = ' num2str(data{tr,5}.irr_red(pulse,iter)) ' ' 'mW/mm^{2}'],'Color','r');hold on;
text(7000, min(filt_traces(1:10000,:))-60, ['irradiance blue = ' num2str(data{tr,4}.irr_blue(pulse,iter)) ' ' 'mW/mm^{2}'],'Color','b');
else
legend('AMPA');
legend boxoff;
text(7000, min(filt_traces(1:10000,:))+100, ['irradiance red = ' num2str(data{tr,5}.irr_red(pulse,iter)) ' ' 'mW/mm^{2}'],'Color','r');hold on;
text(7000, min(filt_traces(1:10000,:))+40, ['irradiance blue = ' num2str(data{tr,4}.irr_blue(pulse,iter)) ' ' 'mW/mm^{2}'],'Color','b');
end
%%
else
tr=3;
pulse=2;
base_start = 1;
base_end = 99;
pulse_start = 100;
pulse_end = 110;
redpeak_start = 100;
redpeak_end = 349;
bluepeak_start = 351;
bluepeak_end = 400;
figure;
set(gcf, 'Position', [200, 0, 1000, 500]);
hold on;
for i=1:11
raw_traces=data{tr,5}.ephys_traces(:,i,pulse);
cutoff = 1000; % Hz (use 500 Hz for mini event / amplitude detection and 1000Hz for max currents. Chen & Regehr 2000)
order = 4; % filter order ('pole'). (use 4 pole for minis and max current. Chen & Regehr 2000)
type = 'Butter';
sr=10000;
srF=10;
filt_traces = lowpassfilt(raw_traces, order, cutoff, sr, type);
plot(filt_traces(1:10000,:),'Color',[1 1 1]-0.08*i);
%hold on;plot(data{tr,5}.ephys_traces(1:10000,8:11,4)+50,'Color','k');
end
hold on;
y1=get(gca,'ylim');
x1= redpeak_start*srF;
hold on;
p1=plot([x1 x1],y1,'--','Color','r');
p1.Color(4) = 1;
hold on;
y1=get(gca,'ylim');
x1=redpeak_end*srF;
hold on;
p2=plot([x1 x1],y1,'--','Color','b');
p2.Color(4) = 1;
hold on;
% y1=get(gca,'ylim');
% x1=bluepeak_start*srF;
% hold on;
% p3=plot([x1 x1],y1,'--','Color','b');
% p3.Color(4) = 0.3;
% hold on;
y1=get(gca,'ylim');
x1=bluepeak_end *srF;
hold on;
p4=plot([x1 x1],y1,'--','Color','b');
p4.Color(4) = 1;
xlabel('Time (ms)');
ylabel('Synaptic input (pA)');
set(gca,'XTick',[0:1000:10000],'XTickLabel',{'0','100','200','300','400','500','600','700','800','900','1000'});
end
%% CONCATENATE RAMPS
if concatenate_ramp_display==1
tr=5;
pulse=2;
base_start = 1;
base_end = 99;
pulse_start = 100;
pulse_end = 110;
redpeak_start = 100;
redpeak_end = 349;
bluepeak_start = 351;
bluepeak_end = 400;
figure;
set(gcf, 'Position', [200, 0, 1000, 500]);
hold on;
for i=1:11
raw_traces=data{tr,5}.ephys_traces(:,i,pulse);
cutoff = 1000; % Hz (use 500 Hz for mini event / amplitude detection and 1000Hz for max currents. Chen & Regehr 2000)
order = 4; % filter order ('pole'). (use 4 pole for minis and max current. Chen & Regehr 2000)
type = 'Butter';
sr=10000;
srF=10;
filt_traces(:,i) = lowpassfilt(raw_traces, order, cutoff, sr, type);
power_red(:,i)=data{tr,5}.irr_red(pulse,i);
power_blue(:,i)=data{tr,4}.irr_blue(pulse,i);
end
temp=filt_traces(1:10000,:);
concatenate_ramp=horzcat(temp(:));
temp=[];
figure;plot(concatenate_ramp,'Color','k');
xlabel('Ramp Nr.');
ylabel('Synaptic input (pA)');
set(gca,'XTick',[0:10000:110000]);
hold on
red_mov=[1000:10000:110000];
blue_mov=[3500:10000:110000];
for i=1:11;
y1=get(gca,'ylim');
x1= red_mov(i);
hold on;
p1=plot([x1 x1],y1,'--','Color','r');
p1.Color(4) = 1;
end
for i=1:11;
y1=get(gca,'ylim');
x1= blue_mov(i);
hold on;
p1=plot([x1 x1],y1,'--','Color','b');
p1.Color(4) = 1;
end
in_val=interp1(1:6,power_red(1:6),[7:11],'linear','extrap');
ir_red=[power_red(1:6) in_val];
ir_blue=power_blue;
figure;scatter(1:11,power_blue,'Marker','+')
figure;scatter(1:11,ir_blue,'Marker','+')
hold on;scatter(1:11,ir_red,'Marker','+')
box off
end