Skip to content

Commit

Permalink
v3.2.3
Browse files Browse the repository at this point in the history
1. Bugfix: incorrect "gather" function was called when Bigdata toolbox is installed in Matlab R2017.

2. Faster and more robust fft_clean operation (run if `fft_thresh` > 0)
  It can handle a limited GPU memory.
`nLoads_gpu` parameter is introduced, which is the ratio of the system memory (RAM) to GPU memory.
  If your GPU memory size is 12 GB and RAM is 96 GB, set nLoads_gpu = 8.
  Increase this value if GPU error occurs (default: 8), do not change the default value otherwise.
  `nSamples_gpu` is now deprecated, and automatically calculated from `nLoads_gpu` parameter.
  • Loading branch information
jamesjun committed Jan 3, 2018
1 parent 76edc8f commit 29e64bd
Show file tree
Hide file tree
Showing 5 changed files with 251 additions and 153 deletions.
13 changes: 13 additions & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
J. James Jun

--------------------------------------------------------------------
[2019/1/3: v3.2.3]
Bugfix: incorrect "gather" function was called for R2017b when Bigdata toolbox is installed.
Faster and more robust fft_clean operation (run if `fft_thresh` > 0)
It can handle a limited GPU memory.
`nLoads_gpu` parameter is introduced, which is the ratio of the system memory (RAM) to GPU memory.
If your GPU memory size is 12 GB and RAM is 96 GB, set nLoads_gpu = 8.
Increase this value if GPU error occurs (default: 8), do not change the default value otherwise.
`nSamples_gpu` is now deprecated, and automatically calculated from `nLoads_gpu` parameter.

[2017/12/30: v3.2.2]
Bugfix: PSTH histogram plot error is fixed and two PSTH plots are displayed
top and bottom when two units are selected.

[2017/12/29: v3.2.1]
Old multishank probe file format is supported (v1, jrclust.m).
'cviShank' which is a cell containing a list of sites is converted to 'shank' format
Expand Down
6 changes: 3 additions & 3 deletions default.prm
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ fInverse_file = 0; % Set to 1 to flip the polarity of the signal
header_offset = 0; % File header offset (set to 0 for files containing no header info (e.g. WHISPER format)

% #Execution parameters
version = 'v3.2.1'; % JRCLUST version. Updated on Dec 29, 2017
version = 'v3.2.3'; % JRCLUST version. Updated on Jan 3, 2018
fVerbose = 0; % Verbose flag, set to 0 to suppress displaying extra information
fParfor = 1; % Use Multiple CPU cores (if parallel processing toolbox is installed)
fGpu = 1; % Use GPU if parallel processing toolbox is installed
iGpu = 1; % Use specific GPU ID (run 'gpuDevice()' to retrieve the list of GPUs)
MAX_BYTES_LOAD = []; % Default memory loading block size (bytes)
MAX_LOAD_SEC = []; % Maximum loading duration (seconds). This overrides "MAX_BYTES_LOAD".
MAX_LOG = 5; % Maximum number of histories to track for 'manual' GUI
nSamples_gpu = 250000; % Number of samples to process in GPU at a time. Reduce this number if GPU crashes for high-channel arrays
MAX_LOG = 5; % Maximum number of histories to track for 'manual' GUI
nLoads_gpu = 8; % Ratio of RAM to GPU memory. If your GPU memory is 12 GB and RAM is 96 GB, set nLoads_gpu = 8. Increase this number if you get GPU memory error.
vcFile_thresh = ''; % Name of .mat file taht stores the spike detection threshold in 'vnThresh_site' variable. Created by 'preview' GUI
sec_per_load_preview = 1; % Recording duration (sec) per continuous segment to preview
nLoads_max_preview = 30; % Number of time segments to load for preview
Expand Down
29 changes: 11 additions & 18 deletions fft_clean.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function mr1 = fft_clean(mr, thresh, nbins)
% mr must be single

if nargin<2, thresh = 6; end
if nargin<3, nbins = 20; end
nSkip_med = 4;
Expand All @@ -8,22 +10,16 @@
if thresh==0, thresh = []; end
if isempty(thresh), mr1=mr; return ;end

mr = single(mr);
% mr = single(mr);
vrMu = mean(mr, 1);
mr1 = bsxfun(@minus, mr, vrMu);
n = size(mr1,1);
% pad if needed
n_pow2 = 2^nextpow2(n);
% try
if n < n_pow2
mr1 = fft(mr1, n_pow2);
else
mr1 = fft(mr1);
end
% catch
% disp('fft_clean: GPU-based FFT failed. Trying CPU-based FFT. Reset GPU or restart Matlab.');
% mr1 = fft(gather(mr1), n_pow2); %GPU-based FFT failed
% end
if n < n_pow2
mr1 = fft(mr1, n_pow2);
else
mr1 = fft(mr1);
end
n1 = floor(n_pow2/2);
viFreq = (1:n1)';
% vrFft1 = abs(mean(bsxfun(@times, mr1(1+viFreq,:), viFreq), 2));
Expand Down Expand Up @@ -64,12 +60,9 @@

mr1(1+vi_noise,:) = 0;
mr1(end-vi_noise+1,:) = 0;
mr1 = real(ifft(mr1)); %slow
if n < n_pow2
mr1 = mr1(1:n,:);
end


mr1 = real(ifft(mr1, n_pow2, 'symmetric')); %~30% faster than below
% mr1 = real(ifft(mr1));
if n < n_pow2, mr1 = mr1(1:n,:); end
mr1 = bsxfun(@plus, mr1, vrMu); %add mean back

if nargout==0 || fDebug
Expand Down
Binary file added img/manual_gui_menu.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 29e64bd

Please sign in to comment.