Skip to content

Commit be7568e

Browse files
committed
Added average CCG to Suppl. Fig. 3
1 parent b6d4326 commit be7568e

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

paper/suppl_fig_xcorr.m

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,43 @@
99
key.project_name = 'NoiseCorrAnesthesia';
1010
key.sort_method_num = 5;
1111
key.spike_count_start = 30;
12+
key.spike_count_end = 2030;
1213
key.max_instability = 0.1;
1314
key.min_trials = 20;
1415
key.min_cells = 10;
1516
key.max_contam = 0.1;
1617
key.state = 'anesthetized';
1718

18-
fig = Figure(101, 'size', [60 60]);
19+
fig = Figure(101, 'size', [120 60]);
1920

20-
[ccg, c, cb] = fetchn(nc.CrossCorr * nc.Anesthesia * nc.CleanPairs & key, 'ccg', 'r_ccg', 'r_ccg_bair');
21+
rel = nc.CrossCorr * nc.Anesthesia * nc.CleanPairs * nc.NoiseCorrelations;
22+
ccg = fetchn(rel & key & 'distance > 0', 'ccg');
2123
ccg = mean([ccg{:}], 2);
24+
ccg = (ccg + flipud(ccg)) / 2; % make symmetric
25+
T = size(ccg, 1);
26+
t = (1 : T) - (T + 1) / 2;
27+
28+
subplot(1, 2, 1)
29+
plot(t, ccg, 'k')
30+
set(gca, 'xlim', 500 * [-1 1], 'xtick', -500 : 250 : 500, 'ylim', [0 1] * 1e-3)
31+
xlabel('Time lag (ms)')
32+
ylabel('Cross-correlation (coincidences/spike)')
33+
34+
[c, cb] = fetchn(nc.CrossCorr * nc.Anesthesia * nc.CleanPairs & key, 'r_ccg', 'r_ccg_bair');
2235
c = [c{:}];
2336
cb = [cb{:}];
2437
ndx = ~any(isnan(cb) | imag(cb) | isnan(c), 1);
2538
C = mean(c(:, ndx), 2);
2639
Cb = mean(cb(:, ndx), 2);
27-
T = size(ccg, 1);
28-
[~, order] = sort(abs((1 : T) - (T + 1) / 2));
29-
Ccg = cumsum(ccg(order));
3040
t = 1 : numel(C);
31-
plot(t, Cb, 'r', t, C, 'k', t, Ccg(1 : 2 : end) / Ccg(end) * C(end), ':k')
41+
42+
subplot(1, 2, 2)
43+
plot(t, Cb, 'r', t, C, 'k')
3244
set(gca, 'xscale', 'log', 'xlim', [1 2000], 'ylim', [0 0.1], 'xtick', ...
3345
[1 10 100 1000], 'xticklabel', [1 10 100 1000])
3446
xlabel('Integration time (ms)')
35-
ylabel('Noise correlation')
36-
legend({'Bair''s method', 'Normalized by total variance', 'Unnormalized and rescaled'})
47+
ylabel('Cumulative correlation')
48+
legend({'Bair''s method', 'Normalized by total variance'})
3749

3850
fig.cleanup()
3951

0 commit comments

Comments
 (0)