-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathraster_PSTH_examples.m
More file actions
120 lines (101 loc) · 3.74 KB
/
raster_PSTH_examples.m
File metadata and controls
120 lines (101 loc) · 3.74 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
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
function raster_PSTH_examples(cellids, resdir)
%RASTER_PSTH_EXAMPLES Example raster plots and PSTHs.
% RASTER_PSTH_EXAMPLES(CELLIDS,RESDIRS) performs spike prealignment,
% raster plot and PSTH calculation for cells specified by CELLIDS. Result
% plots generated by VIEWCELL2B (CellBase) are saved in RESDIR.
%
% See also PREALIGNSPIKES and VIEWCELL2B.
% Code review: BH 12/2/19, 4/8/20
%Panna Hegedus, Balazs Hangya
%Institute of Experimental Medicine
%hangya.balazs@koki.mta.hu
%05-Feb-2020
% Input argument check
narginchk(0,4)
% Animal, session
if isempty(cellids)
cellids = { 'HDB13_170228a_2.1';
'HDB13_170301a_3.2';
'HDB32_181121a_5.3';
'HDB32_181130a_2.2';
'HDB32_181130a_4.1';
'HDB25_180401a_7.3';
};
end
% Stop if error
dbstop if error
% Directories
if ~isfolder(resdir)
mkdir(resdir)
end
% Prealign spikes for trial events
problem_behav_cellid = [];
for iC = 1:length(cellids)
cellid = cellids(iC);
try
prealignSpikes(cellid,'FUNdefineEventsEpochs',@defineEventsEpochs_pavlovian,'filetype','event','ifsave',1,'ifappend',0)
catch
disp('Error in prealignSpikes.');
problem_behav_cellid = [problem_behav_cellid cellid];
end
end
% Activated by cue
G = figure;
pause(0.01)
viewcell2b(cellids(1),'TriggerName','StimulusOn','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'DeliverAllFeedback'}},'Partitions','#TrialType','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(1));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_stimuluson_excitation.jpg']); % save
saveas(G,fnm)
close(G)
% Inhibited by cue
G = figure;
pause(0.01)
viewcell2b(cellids(3),'TriggerName','StimulusOn','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'DeliverAllFeedback'}},'Partitions','#TrialType','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(3));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_stimuluson_inhibition.jpg']); % save
saveas(G,fnm)
close(G)
% Activated by reward
G = figure;
pause(0.01)
viewcell2b(cellids(5),'TriggerName','DeliverAllFeedback','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'StimulusOn'}},'Partitions','#RewardedTrials','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(5));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_reward_excitation.jpg']); % save
saveas(G,fnm)
close(G)
% Inhibition by reward
G = figure;
pause(0.01)
viewcell2b(cellids(2),'TriggerName','DeliverAllFeedback','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'StimulusOn'}},'Partitions','#RewardedTrials','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(2));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_reward_inhibition.jpg']); % save
saveas(G,fnm)
close(G)
% Activated by punishment
G = figure;
pause(0.01)
viewcell2b(cellids(4),'TriggerName','DeliverAllFeedback','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'StimulusOn'}},'Partitions','#PunishedTrials','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(4));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_punishment_excitation.jpg']); % save
saveas(G,fnm)
close(G)
% Inhibited by punishment
G = figure;
pause(0.01)
viewcell2b(cellids(6),'TriggerName','DeliverAllFeedback','SortEvent','TrialStart','sigma', 0.07,'eventtype','behav','ShowEvents',{{'StimulusOn'}},'Partitions','#PunishedTrials','window',[-3 3])
maximize_figure(G)
cellidt = char(cellids(6));
cellidt(cellidt=='.') = '_';
fnm = fullfile(resdir,[cellidt '_punishment_inhibition.jpg']); % save
saveas(G,fnm)
close(G)