|
9 | 9 | key.project_name = 'NoiseCorrAnesthesia'; |
10 | 10 | key.sort_method_num = 5; |
11 | 11 | key.spike_count_start = 30; |
| 12 | +key.spike_count_end = 2030; |
12 | 13 | key.max_instability = 0.1; |
13 | 14 | key.min_trials = 20; |
14 | 15 | key.min_cells = 10; |
15 | 16 | key.max_contam = 0.1; |
16 | 17 | key.state = 'anesthetized'; |
17 | 18 |
|
18 | | -fig = Figure(101, 'size', [60 60]); |
| 19 | +fig = Figure(101, 'size', [120 60]); |
19 | 20 |
|
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'); |
21 | 23 | 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'); |
22 | 35 | c = [c{:}]; |
23 | 36 | cb = [cb{:}]; |
24 | 37 | ndx = ~any(isnan(cb) | imag(cb) | isnan(c), 1); |
25 | 38 | C = mean(c(:, ndx), 2); |
26 | 39 | Cb = mean(cb(:, ndx), 2); |
27 | | -T = size(ccg, 1); |
28 | | -[~, order] = sort(abs((1 : T) - (T + 1) / 2)); |
29 | | -Ccg = cumsum(ccg(order)); |
30 | 40 | 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') |
32 | 44 | set(gca, 'xscale', 'log', 'xlim', [1 2000], 'ylim', [0 0.1], 'xtick', ... |
33 | 45 | [1 10 100 1000], 'xticklabel', [1 10 100 1000]) |
34 | 46 | 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'}) |
37 | 49 |
|
38 | 50 | fig.cleanup() |
39 | 51 |
|
|
0 commit comments