-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathShun_loadOptoSweepData.m
More file actions
executable file
·61 lines (52 loc) · 2.26 KB
/
Shun_loadOptoSweepData.m
File metadata and controls
executable file
·61 lines (52 loc) · 2.26 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
% Shun_loadOptoSweepData.m
% 2025/09/18
%% Single session analysis
clear; close all;
addpath(genpath(osPathSwitch('/Volumes/Neurobio/MICROSCOPE/Shun/Analysis/NeuroDAP/Methods')));
% Select sessions via uipickfiles
sessionList = uipickfiles('FilterSpec',osPathSwitch('/Volumes/Neurobio/MICROSCOPE/Shun/Project clamping/Recordings'))';
errorSessionIdx = [];
% Select anlaysis params
[analysisParams,canceled] = inputAnalysisParams(sessionList,...
reloadAll=false,...
recordLJ='[1 0 0]',...
plotPhotometry=true,...
withPhotometryNI=true);
if canceled; return; end
for s = 1:length(sessionList)
analysisParams(s).rollingWindowTime = str2double(analysisParams(s).rollingWindowTime);
analysisParams(s).recordLJ = eval(analysisParams(s).recordLJ);
end
% Run each session
for s = 1:length(sessionList)
close all;
clearvars -except s sessionList errorSessionIdx analysisParams taskList redStimPatternList blueStimPatternList withPhotometryNI plotPhotometry reloadAll
idx = s; % if loop through all
% idx = errorSessionIdx(s); % if loop through error sessions
dirsplit = strsplit(sessionList{idx},filesep);
sessionName = dirsplit{end}; clear dirsplit
try
loadSessions(sessionList{idx},reloadAll=analysisParams(idx).reloadAll,...
NISetup='clamp',...
invertStim=false,...
withPhotometryNI=analysisParams(idx).withPhotometryNI,photometryNI_mod=false,...
recordLJ=analysisParams(idx).recordLJ,...
rollingWindowTime=analysisParams(idx).rollingWindowTime,...
followOriginal=false);
analyzeSessions_optoSweeps(sessionList{idx},...
laserSource='clamp',...
durationList=[0.1, 0.5, 1],...
bluePower=[20,30,40],...
redPower=[45, 55],...
redo=true,round=false,...
plotPhotometry=analysisParams(idx).plotPhotometry,...
shortTimeRange=[-1,5],longTimeRange=[-5,10]);
catch ME
errorSessionIdx = [errorSessionIdx;idx];
disp(getReport(ME));
warning(['Session ', sessionName, ' have an error, skipped for now!!!!']);
continue
end
end
close all
return