-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalyze_events.m
More file actions
84 lines (50 loc) · 1.76 KB
/
analyze_events.m
File metadata and controls
84 lines (50 loc) · 1.76 KB
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
%load('ctrl-events.mat');
%load('exp-events.mat');
load('events.mat');
amplitudes = [];
latencies = [];
event_latencies = [];
event_onsets = [];
life_times = [];
figure;
stimulus_time_point = 200;
for i = 1:numel(all_events)
intensities = all_events{i}{2};
for j = 1:size(intensities, 1)
% plot(intensities(j, :));
% w = gausswin(30);
% w = gausswin(30);
% intensities(j, :) = filter(w, 1, intensities(j, :));
intensities(j, :) = smooth(intensities(j, :), 30);
% plot(intensities(j, :));
end
%intensity = imgaussfilt(intensity, 10.0);
if numel(intensities) == 0
continue
end
[mv, mi] = max(intensities(:, stimulus_time_point:(stimulus_time_point + 400)), [], 2);
latencies = [latencies; mi];
for j = 1:numel(all_events{i}{1})
events = all_events{i}{1}{j};
for k = 1:numel(events)
e = events(k).events;
sigma = events(k).sigma;
max_a = max(e(:, 4)) / sigma;
amplitudes = [amplitudes max_a];
latency = e(1, 1);
life_time = e(end, 1) - e(1, 1) + 1;
if life_time / 100. < 1.0
continue;
end
life_times = [life_times life_time];
event_latencies = [event_latencies latency];
end
end
end
event_latencies = event_latencies / 100.;
life_times = life_times / 100.;
latencies = latencies / 100.;
se = std(latencies) / sqrt(length(latencies));
disp(mean(latencies));
disp(se);
disp(mean(amplitudes));