|
5 | 5 | stimPosition = {'anterior'}; |
6 | 6 | wormPrep = {'dissected'}; |
7 | 7 | cellDist = [40 150]; |
8 | | -extFilterFreq = 5; |
| 8 | +extFilterFreq = [2.5 5]; |
9 | 9 | includeFlag = 1; |
10 | 10 |
|
11 | 11 | antSineCells = FilterRecordings(ephysData, ephysMetaData,... |
|
16 | 16 |
|
17 | 17 | clear cellDist strainList internalList cellTypeList stimPosition resistCutoff ans wormPrep; |
18 | 18 |
|
| 19 | +%NEXT: check to see if there's a difference in the power spectrum (and |
| 20 | +%amplitude attenuation where applicable) for 2.5 vs. 5kHz photodiode |
| 21 | +%signals. If they look the same, combine the data. |
| 22 | + |
19 | 23 | %% |
| 24 | + |
20 | 25 | ExcludeSweeps(ephysData, protList, antSineCells, 'matchType', matchType, 'channel', 1); |
21 | 26 |
|
22 | 27 | clear protList matchType; |
23 | 28 |
|
| 29 | +%% Check if the PD signal is useful/shows abnormalities |
| 30 | +% Make list of only sweeps with stable current AND good PD signal (lower |
| 31 | +% noise, high enough voltage for SNR, no weird movements during sine) |
| 32 | + |
| 33 | +% selectedSweeps_I = ExcludeSweeps(ephysData, protList, antSineCells, 'matchType', matchType, 'channel', 1); |
| 34 | +% selectedSweeps_PD = ExcludeSweeps(ephysData, protList, antSineCells, 'matchType', matchType, 'channel', 3); |
| 35 | + |
| 36 | +selectedSweeps_I = ImportMetaData(); |
| 37 | +selectedSweeps_PD = ImportMetaData(); |
| 38 | + |
| 39 | + |
| 40 | +% This method of comparing the two lists only works if there's only one |
| 41 | +% series/sweep per row. It simply concatenates cell ID, series, and sweep |
| 42 | +% number into a char row. For more sweeps per series, you will need to loop |
| 43 | +% (find matching cell/series combo, then check which sweeps are matching). |
| 44 | +a = selectedSweeps_I; |
| 45 | +b = selectedSweeps_PD; |
| 46 | +a(:,2) = cellfun(@num2str, a(:,2),'un',0); |
| 47 | +b(:,2) = cellfun(@num2str, b(:,2),'un',0); |
| 48 | + |
| 49 | +a = cellfun(@(x,y,z) [x y z], a(:,1),a(:,2),a(:,3),'un',0); |
| 50 | +b = cellfun(@(x,y,z) [x y z], b(:,1),b(:,2),b(:,3),'un',0); |
| 51 | +a = vertcat(a{:}); |
| 52 | +b = vertcat(b{:}); |
| 53 | + |
| 54 | +selectIdx = ismember(a,b,'rows'); |
| 55 | + |
| 56 | +selectedSweeps = selectedSweeps_I(selectIdx,:); |
| 57 | +selectedSweeps(:,3) = cellfun(@(x) ['' x],selectedSweeps(:,3)); |
| 58 | + |
| 59 | +% save the new selectedSweeps list to file |
| 60 | +[filename, pathname] = uiputfile(... |
| 61 | + {'*.xls;*.xlsx', 'Excel files'; |
| 62 | + '*.*', 'All files'}, ... |
| 63 | + 'Save sweep list to .xls file:'); |
| 64 | +fName = fullfile(pathname,filename); |
| 65 | +xlswrite(fName, selectedSweeps); |
| 66 | + |
| 67 | +clear fName filename pathname a b selectedSweeps_I selectedSweeps_PD selectedSweeps selectIdx |
| 68 | + |
| 69 | + |
24 | 70 | %% |
25 | 71 | sinePeaksNorm = FrequencyAnalysis(ephysData, ephysMetaData, protList, 'matchType', matchType, 'norm', 1); |
26 | 72 |
|
| 73 | +sinePeaks = FrequencyAnalysis(ephysData, ephysMetaData, protList, 'matchType', matchType, 'norm', 0); |
27 | 74 | % okay we're just going to plot the power spectrum in the morning and |
28 | 75 | % ignore the bode plot because I don't know what a "system" object really |
29 | 76 | % is in matlab or if my data can be one, or what a linear time-invariant |
|
97 | 144 |
|
98 | 145 | %% Plot steady state sine comparison |
99 | 146 |
|
| 147 | +whichPeaks = sinePeaksNorm; |
| 148 | + |
100 | 149 | eachFreq = [0 10 30 100 200 500 1000]; |
101 | 150 | sf = 10000; %Hz |
102 | 151 | allSteady = []; |
103 | 152 | allSize = []; |
104 | 153 |
|
105 | | -for iRec = 1:size(sinePeaksNorm,1) |
106 | | - theseSizes = sinePeaksNorm{iRec,3}(:,[1:3,5]); |
| 154 | +for iRec = 1:size(whichPeaks,1) |
| 155 | + theseSizes = whichPeaks{iRec,3}(:,[1:3,6]); |
107 | 156 |
|
108 | 157 | for iFreq = 1:size(theseSizes,1) |
109 | 158 | allSteady = [allSteady; theseSizes(iFreq,4)]; |
|
0 commit comments