Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bleeding edge matlab #258

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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