Skip to content

Commit

Permalink
Merge pull request #258 from Julie-Fabre/bleeding_edge_matlab
Browse files Browse the repository at this point in the history
Bleeding edge matlab
  • Loading branch information
Julie-Fabre authored Feb 3, 2025
2 parents eaba732 + b0bbd72 commit 9c8306f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 0 additions & 1 deletion +bc/+qm/+helpers/getSpatialDecay.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@

% Perform exponential fit using lsqcurvefit
[fitParams, ~, residual, ~, ~, ~, jacobian] = lsqcurvefit(expDecayFun, initialGuess, spatialDecayPoints_loc, spatialDecayPoints', [], [], options);

spatialDecaySlope = fitParams(2); % The decay rate is the second parameter
spatialDecayFit = fitParams;

Expand Down
12 changes: 9 additions & 3 deletions +bc/+qm/waveformShape.m
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
% (find peaks and troughs using MATLAB's built-in function)
thisWaveform = templateWaveforms(thisUnit, :, maxChannel);
nChannels_to_eval = 1;
if any(isnan(thisWaveform)) % kilosort can sometimes return all NaNs in a waveform, we classify these units as noise
if any(isnan(thisWaveform)) || all(thisWaveform == 0) % kilosort can sometimes
% return all NaNs or zeros in a waveform (not sure why), we classify these units as noise
nPeaks = NaN;
nTroughs = NaN;
mainPeak_before_size = nan(1,nChannels_to_eval);
Expand All @@ -74,7 +75,7 @@
peakLocs = NaN;
troughLocs = NaN;
waveformDuration_peakTrough = NaN;
if param. param.spDecayLinFit
if param.spDecayLinFit
num_buff = 6;
else
num_buff = 10;
Expand All @@ -84,11 +85,16 @@
waveformBaseline = NaN;
spatialDecayPoints_loc = nan(1, num_buff);
spatialDecayFit_1 = NaN;
scndPeakToTroughRatio = NaN;
mainPeakToTroughRatio = NaN;
peak1ToPeak2Ratio = NaN;
troughToPeak2Ratio = NaN;

else
% get waveform peaks, troughs locations, sizes and widths for top 17
% channels
theseChannels = maxChannel; % - 8 : maxChannel + 8;
for iChannel = 1%:17 % evaluate peak and trough sizes and widths for top 17 channels
for iChannel = 1%:17 % evaluate peak and trough sizes and widths for top 17 channels (To do - only 1 channel for now)
if theseChannels(iChannel) > 0 && theseChannels(iChannel) <= size(templateWaveforms,3)
if theseChannels(iChannel) == maxChannel
thisWaveform = templateWaveforms(thisUnit, :, theseChannels(iChannel));
Expand Down

0 comments on commit 9c8306f

Please sign in to comment.