JaneliaSciComp / JRCLUST

JRCLUST
Apache License 2.0
34 stars 22 forks source link

Error when running JRC on large experiments #25

Closed gbekheet closed 5 years ago

gbekheet commented 6 years ago

Hi,

I'm using JRC to detect and sort spikes in an experiment that is ~180GB. When using detect(), JRC says there are 97 operations to be completed. It moves through it nicely, but at operation 40/97 I'm given the following error:

Output argument "fGpu" (and maybe others) not assigned during call to "jrc3>wav2spk_".

image

JRC spikesorting worked fine on the sample experiment and a smaller experiment of ~6GB.

Any advice?

Thanks, GB :)

aliddell commented 6 years ago

Hi. Support has been in flux for JRCLUST, and we're sorry for that. Are you still having this problem? Can you post your param file?

RyanLoh2 commented 6 years ago

@aliddell

I am not the OP, but I am having this same error. I am copying my parameter file below

% Default parameters for jrclust (default.prm)

% #Recording file format
vcFile = '';            % Raw recording file path (leave empty if multiple files are sorted together)
csFile_merge = '719_run_01_g0*.bin';            % List of recording files to merge (leave empty if single file is used)
sort_file_merge = 1;            % Sort files by the 0: alphabetical order, 1: metafile, 2: file created time, 3: file modified time, 4: numerical order in the file names
vcFile_prm = '.\719_run_01_g0_Loh_32_Chronic_Whisper.prm';          % Current parameter file path (.prm) if left empty
template_file = '';         % Template parameter file path (.prm). Parameters in this file override the default parameter file (default.prm), but get overridden is by the parameter file.
probe_file = 'Loh_32_Chronic_Whisper.prb';          % Probe file to use (.prb). Default search location: prb\
nChans = 40;            % # channels stored
vcDataType = 'int16';           % Raw data format. Choices: {'int16', 'uint16', 'int32', 'uint32', 'single', 'double'}
sRateHz = 20833;            % Sampling rate (Hz)
uV_per_bit = 0.305176;          % Bit scaling factor (uV/bit)
fTranspose_bin = 1;         % Set to 1 if the recording file is written in the channel order at different times
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.5';         % JRCLUST version. Updated on Jan 8, 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
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
offset_sec_preview = 0;         % Time offset (sec) to apply to the preview
fCacheRam = 1;          % Cache spikew aveform information in RAM. Uses more RAM but faster
fRamCache = 1;          % Cache both raw and filtered spike waveforms in RAM (greater memory demand)
fSavePlot_RD = 1;           % Save the Rho-Delta plot as .png file (prefix: '_RD.png' at the end of the .prm file name)

% #Display parameters (Affects display only, (*):Can be modified in the manual GUI)
tlim = [0, 0.2];            % Time range to display 
nTime_traces = 1;           % Number of time segments to display. Set to 1 to show one continuous time segment
nSkip_show = 1;         % Show 1 in n samples when plotting traces
fSpike_show = 1;            % show spikes in the trace view (*)
maxAmp = 250;           % Amplitude range in uV (initial setting, changeable in UI) (*)
nShow = 200;            % Maximum number of traces to show [D?# spikes to show]
corrLim = [0.9, 1];         % Correlation color plot range
nSpk_show = 30;         % show spike waveforms for manual clustering
nShow_proj = 500;           % Max. number of spikes to show in the projection view
vcFet_show = 'vpp';         % Feature to show in time plot {'vpp', 'cov', 'pca'} (*)
mrColor_proj = [0.75, 0.75, 0.75; 0, 0, 0; 1, 0, 0];            % background, selected, comparison color
vcFilter_show = '';         % Filter to apply in the "traces" view. Choices: {'', 'bandpass', 'sgdiff'}. '' uses vcFilter setting.
fText = 1;          % Show spike count per unit (*, press 'n' to toggle in manual GUI)

% #Pre-processing (run "jrc spikesort" after change)
tlim_load = [];         % Time range to load in sec (uses all time range if set to empty)
vcFilter = 'ndiff';         % {'ndiff', 'sgdiff', 'bandpass', 'fir1', 'user', 'fftdiff', 'none'}
nDiff_filt = 2;         % Differentiation filter for vcFilter='sgdiff', ignored otherwise. Set to [] to disable. 2n+1 samples used for centered differentiation
freqLim = [300, 3000];          % Frequency cut-off limit for vcFilter='bandpass', ignored otherwise. 
filtOrder = 3;          % Bandpass filter order
fEllip = 1;         % Use Elliptic filter. set to 0 for Butterworth filter. Only valid for vcFilter='bandpass'.
vnFilter_user = [];         % User-specified filter kernel. Used if vcFilter='user' is set.
fft_thresh = 0;         % Automatically remove frequency outliers (unit:MAD, 10 recommended, 0 to disable). Verify by running "jrc traces" and press "p" to view the power spectrum.
freqLimNotch = {};          % Notch filter frequency range to exclude manually. {[start1, end1], [start2, end2]}. Can be used in conjunction with fft_thresh.
vcCommonRef = 'mean';           % common reference mode {'none', 'mean', 'median', 'whiten'}
viSiteZero = [];            % Site# to ignore manually
nPad_filt = 100;            % Number of samples to overlap between multiple loading (filter edge safe).
gain_boost = 1;         % multiply the raw recording by this gain to boost uV per bit
thresh_corr_bad_site = [];          % Automatically reject bad sites based on the max. correlation with neighboring sites using raw waveforms. Set to [] to disable

% #Spike detection and grouping (run "jrc spikesort" after change)
qqFactor = 5;           % Spike detection thresold (Threshold = qqFactor*S, S = med(x-med(x))/.6745). (RQ Quiroga'04).
qqSample = 4;           % Median subsample factor (1 every n)
spkThresh_uV = [];          % Manual threshold (applies to all channels)
spkThresh_max_uV = [];          % maximum absolute amp. allowed
spkLim_ms = [-0.25, 0.75];          % Time range to capture the filtered spike waveforms; spkLim = round(P.spkLim_ms/1000*P.sRateHz)
spkLim_raw_ms = [];         % Raw spike waveform range, setting to [] will use spkLim_raw_factor to determine spkLim_raw (# samples)
spkLim_raw_factor = 2;          % if spkLim_raw_ms==[] then spkLim_raw = spkLim * spkLim_raw_factor
maxSite = [];           % Auto-calculated by `maxDist_site_spk_um` if empty. `nSites_spk` = 1+2*`maxSite`-`nSite_ref`)
spkRefrac_ms = 0.25;            % Detection refractory period in milliseconds
vcSpatialFilter = 'none';           % Spatial filter for detection {'mean', 'imec2', 'subtract', 'csd'}
fSaveEvt = 1;           % Flag to save event file
fDetectBipolar = 0;         % bipolar amplitude detection (0 means negative)
fSaveRawSpk = 0;            % Save spike detected per site (saves minimum peak)
blank_thresh = [];          % reject spikes exceeding the channel mean after filtering (MAD unit), ignored if [] or 0
blank_period_ms = 5;            % (miliseconds) Duration of blanking when the common mean exceeds a threhold (blank_thresh)
nneigh_min_detect = 0;          % Min. number of neighbors near the spike below threshold. choose between [0,1,2]
maxDist_site_um = 50;           % Radius of spike event merging. Keep spikes that has most negative peaks within x um radius.
maxDist_site_spk_um = 75;           % Max. radius for extracting waveforms. Used if maxSite=[] and nSites_ref=[]
fGroup_shank = 0;           % Group all sites in the same shank

% #Feature extraction (run "jrc spikesort" after change)
vcFet = 'gpca';         % Feature list: {'gpca', 'cov', 'vpp', 'vmin', 'vminmax', 'energy', 'pca'}
nPcPerChan = 1;         % number of principal components per chan.
nSites_ref = [];            % set to 0 for global referencing (move to feature section) @TODO: diagram
vcSpkRef = 'nmean';         % Subtract mean of the spiking event sites {'nmean', 'none'}
fInterp_fet = 1;            % Interpolate the waveforms for feature projection to find the optimal delay (2x interp). Set to 0 to disable

% #Clustering (run "jrc sort" after change)
nTime_clu = 4;          % number of time periods to perform separate clustering (later to be merged after clustering)
dc_percent = 2;         % used for distribution cutting
fRepeat_clu = 0;            % Flag for whether to repeat clustering for the bottom half of the cluster amplitudes.
nThreads = 128;         % number of GPU threads for clustering
nC_max = 45;            % (read-only) Set by the CUDA code. Maximum number of dimensions per event
fSpatialMask_clu = 0;           % Apply spatial mask calculated from the distances between sites to the peak site (half-scale: P.maxDist_site_um). circa v3.1.10
min_sites_mask = 5;         % Minimum number of sites to have to apply spatial mask. Used if fSpatialMask_clu==1. circa v3.1.10

% #Post-cluster auto-merging parameters (run "jrc auto" after change)
delta1_cut = 0.6;           % RL cluster: delta cut-off. Increasing this will produce less clusters.
rho_cut = -2.5;         % RL cluster: rho cut-off. Decreasing (more negative) this will produce more clusters.
maxWavCor = 0.98;           % merge if waveform correlation is greater than maxWavCor.
min_count = 30;         % Minimum cluster size (min_count will be set to 2*#features if lower).
nRepeat_merge = 10;         % # of repeats for average unit raw waveform based merging
vcDetrend_postclu = 'global';           % 'none', 'hidehiko', 'global', 'local', 'logz'
thresh_mad_clu = 7.5;           % This sets the MAD score threshold to remove outlier spikes for each cluster.
maxCluPerSite = 20;         % Maximum clusters per site allowed if local detrending is used.
fDrift_merge = 1;           % Compute multiple waveforms at three drift locations based on the spike position (CoM).
nInterp_merge = 1;          % Interpolation factor for the mean unit waveforms, set to 1 to disable
maxDist_site_merge_um = 35;         % Max. distance separation of the peak sites to consider merging
spkLim_factor_merge = 1;            % Waveform range for computing the correlation. spkLim_factor_merge <= spkLim_raw_factor_merge. circa v3.1.8

% #Trial (used for plotting PSTH for each unit after clustering)
vcFile_trial = '';          % .mat or .csv file containing timestamp in seconds unit. use any variable name.
thresh_trial = [];          % Threshold to detect trial event timing from the TTL pulse. If empty, half between min and max is used.
tRefrac_trial = 0.001;          % Trial timestamp refractory period (sec), disable duplicate events
tlim_psth = [-1, 5];            % Time range to display PSTH (in seconds)
tbin_psth = 0.01;           % Time bin for the PSTH histogram (in seconds)
xtick_psth = 0.2;           % PSTH time tick mark spacing
fAverageTrial_psth = 1;         % Plot PSTH for averaged trial if set to 1, otherwise plot individual trials (opens multiple tabs)
nSmooth_ms_psth = 50;           % PSTH smoothing time window (in milliseconds)
rateLim_psth = [];          % range range in Hz
dinput_imec_trial = 1;          % IMEC digital input channel number (1-16) to generate trial file (vcFile_trial) using 'maketrial-imec' command.

% #Firing rate estimation for unit
sRateHz_rate = 1000;            % Resampled rate for the firing rate
filter_sec_rate = 2;            % Time period to determine the firing rate
filter_shape_rate = 'triangle';         % {'triangle', 'rectangle'} kernel shape for temporal averaging

% #Aux channel (used for correlating with the unit firing rates)
vcFile_aux = '';            % Aux channel file
sRateHz_aux = [];           % sampling rate for aux file
iChan_aux = [];         % Aux channel # to correlate with the unit firing rate    
vcLabel_aux = '';           % Label for the aux channel
vrScale_aux = 1;            % Scale factor for the aux input
nClu_show_aux = 10;         % Max # clusters to show for aux vs. firing rate correlation

% #LFP
vcFile_lfp = '';            % LFP file
sRateHz_lfp = 2500;         % Target LFP sampling rate (Hz)
nSkip_lfp = [];         % downsample factor used to determine sRateHz_lfp if sRateHz_lfp==[]

%--------------------------------------------------------------------------
% Developer's section

% Record Keeping
vcDate_file = '';           % date string. e.g. '19-May-2016 13:02:18'
nBytes_file = [];           % file byte size
duration_file = [];         % recording duration in seconds

% Ground truth
vcFile_gt = '';         % Ground truth file. Default: *_gt.mat. @TODO: Specify the format

% Unit/dipole tracking
um_per_pix = 20;            
maxSite_pix = 4.5;          
nPc_dip = 3;            % Number of principal components for dipole fitting
maxSite_dip = [];           % Number of sites (2n+1) to fit dipole model

% depth tracking
vcMode_track = 'mt_cpsd2_mr';           % LFP tracking method {'mt_psd_mr', 'mt_cpsd_mr', 'cpsd_mr', 'corr_mr', 'mt_cpsd1_mr', 'mt_fft_mr', 'mt_cpsd2_mr', 'mt_cpsd1_mr', 'mt_dpsd_mr'}
tBin_track = 9;         % Duration (sec) per bin
freqLim_track = [15, 150];          % Filter range
freqLim_excl_track = [58, 62];          % Filter range to exclude. Change this for Europe
thresh_corr_track = [];         % Deprecated. correlation drop-off
viDepth_track = [];         % Range of sites to track. set to empty to ignore
fUseCache_track = 0;            % Use pre-stored result
maxSite_track = [2, 3, 4, 5, 6, 7, 8];          % maximum distance for a site pair
nw_lcm_track = 1;           % number of windows for local center of mass 
max_shift_track = [];           % maximum shift distance per bin
fSingleColumn_track = 1;            % Disable by default
viSite_bad_track = [];          % Sites to ignore
pix_per_sec_track = [];         % Descent experiment speed
load_fraction_track = [];           % Fraction of data to load for tracking
viDepth_excl_track = [];            % Depth point to ignore
fSmooth_track = 1;          % Smooth depth tracking result
fUseLfp_track = 1;          % Use LFP info for tracking. set to 0 to use AP band

% Drift correction
cvrDepth_drift = {};            % Time range (s) and depth to correct manually
tbin_drift = [];            % drift correcting time step in sec. Set to empty to skip drift correction
nT_drift = [];          % Number of time steps for drift correction. Set to empty to skip drift correction
ybin_drift = 2;         % drift correcting depth step in um

%--------------------------------------------------------------------------
% Deprecated

% Recording file format
viChan_bin = [];            % channel translation order for bin file [D]
viChan_aux = [];            % aux and sync channels [D]
cviShank = {};          % Shank channel group [D]

% Display parameters
LineStyle = '';         % Line style string [D]
fShowAllSites = 0;          % Show mean traces from all sites [D]
fAddCommonRef = 0;          % Add common ref [D]
iClu_show = [];         % cluster to display %show all by default [D]
maxSite_show = [];          % uses maxSite if empty.  [D]
tlim_lfp = [0, 5];          % lfp viewing range [D]
maxAmp_lfp = 1000;          % Amplitude range in uV (LFP) [D]
freqLim_corr = [15, 150];           % LFP correlation frequency limit [D]
time_tick_show = [];            % Time interval tick marks in secondds, [] for auto [D]
viChan_show = [];           % Show all if empty [D]
fWav_raw_show = 0;          % Show raw waveform (0 to show filtered); [D]

% Pre-processing
nSites_excl_ref = 6;            % excl three nearest sites when perfomaing 'nmean' local referencing [D]
thresh_sd_ref = 5;          % local common referencing threshold (SD) [D]
fSaveSpk = 1;           % flag to save .spk file (large binary) [D]
freqLim_lfp = [];           % LFP filter range in Hz. [#] for lowpass and [#,#] for bandpass [D?]
freqLimNotch_lfp = [];          % Notch filter for LFP band [D?]
fWhiten_traces = 0;         % Apply whitening of the traces after filtering. (kilosort and spykingcircus use this). [D?]
nSkip_whiten = 10;          % use 1 of n for whitening calculation [D?]
fLoad_lfp = 0;          % Load LFP file [D?]
S_imec3 = [];           % imec3 struct [D]
fMeanSite = 1;          % Subtract background noise (mean across sites, nSite=4*maxSite); [D]
fMeanSite_drift = 0;            % Average nearest vertical neighbors (top and down) [D]
vcFilter_detect = '';           % Filter choice to run spike detection {'matched', 'corr'}; [D?]
fCheckSites = 0;            % Automatically reject bad sites if set to 1
maxLfpSdZ = 4.5;            % site rejection threshold (valid if fCheckSites=1)

% Spike detection and grouping
fPcaDetect = 0;         % Detect spikes after projecting waveform in 1st prin. vec.
fRms_detect = 0;            % don't use rms filter for detection if selectec
rms_filt_ms = 0;            % RMS filter for spike detection. Set to 0 to ignore
maxSite_detect = 1.5;           % Max site to sum neighboring channels for detection
refrac_factor = 2;          % Refractory period for the same channel  (spkRefrac_ms x refrac_factor)

% Feature extraction
slopeLim_ms = [0.05, 0.35];         % Slope feature parameter
spkLim_ms_fet = [-0.25, 0.75];          % Spike waveform time range
maxSite_fet = [];           % 2*n number of nearest neighbors for merging
nMinAmp_ms = 0;         % Amplitude minimum search `range`
fRejectSpk_vpp = 0;         % Reject spikes exceedign 2 * thresh
fMinNorm_wav = 0;           % Normalize by min value at max site

% Clustering
dc_frac = [];           
dc_factor = 1;          % higher: merge more, lower: split more
tlim_clu = [];          % time range to cluster, referenced from tlim_load in sec
vcCluDist = 'eucldist';         % Distance: {'neucldist_offset', 'nmaxdist_offset', 'nmaxdist', 'corrdist', 'neucldist', 'eucldist'};
fMeanSiteRef = 0;           % Subtract by mean 
maxSite_sort = [];          % max site distance to compare cluster membership
maxSite_merge = [];         % Number of sites (2n+1) to merge based on waveform similarity
vcDc_clu = 'distr';         % use noise distribution to determine cutoff {noise, distr, entropy, otsu}
fProj_sort = 0;         % PCA project from PCA
fNormRhoDelta = 1;          % remove spikes in delta dimension if set

% Post-cluster parameters (run "jrc auto" after change)
thresh_merge_clu = 0;           % Pierre Yger's cluster merging criterial based on medium projection of cluster pairs
thresh_automerge_pca = [];          % posthoc merge based on the eigvec similarity. recommends .998
thresh_split_clu = 0;           % Split a cluster to two if separation distance > (x) after k-means clustering
fDiscard_count = 1;         % Discard cluster under minimum count. set to zero to absorb to the nearest cluster
vcCluWavMode = 'mean';          % use median to compute average cluster waveform

% Batch process parameters
fProcessReverseOrder = 0;           
fProcessOdd = 0;            
fProcessEven = 0;           
fRun = 1;           % Run the job for batch

% Trial
vcFile_vid = '';            % video file
iChan_vid = [];         % video sync channel, zero-based
flim_vid = [];          % used for video sync, video frame #
tlim_vid = [];          % used for video sync, ephys time
vcFile_bonsai = '';         % bonsai 5-column output (x,y are 2 and 3)``
aliddell commented 6 years ago

@RyanLoh2 thanks for the param file. I'll look into it.

aliddell commented 6 years ago

@RyanLoh2 FYI, I haven't been able to reproduce this on my machine using a data set of comparable size to OP (~163GB). Can you post:

RyanLoh2 commented 6 years ago

Hi @aliddell, Thanks for the assistance. Answering questions below:

1) I have JRC3 (v3.2.5 - 1/8/2018) installed. 2)

 CUDADevice with properties:

                      Name: 'Quadro K2200'
                     Index: 1
         ComputeCapability: '5.0'
            SupportsDouble: 1
             DriverVersion: 9.2000
            ToolkitVersion: 7.5000
        MaxThreadsPerBlock: 1024
          MaxShmemPerBlock: 49152
        MaxThreadBlockSize: [1024 1024 64]
               MaxGridSize: [2.1475e+09 65535 65535]
                 SIMDWidth: 32
               TotalMemory: 4.2950e+09
           AvailableMemory: 3.8711e+09
       MultiprocessorCount: 5
              ClockRateKHz: 1124000
               ComputeMode: Default
      GPUOverlapsTransfers: 1
    KernelExecutionTimeout: 0
          CanMapHostMemory: 1
           DeviceSupported: 1
            DeviceSelected: 1

3)

Maximum possible array:       92020 MB (9.649e+10 bytes) *
Memory available for all arrays:       92020 MB (9.649e+10 bytes) *
Memory used by MATLAB:       10020 MB (1.051e+10 bytes)
Physical Memory (RAM):       65458 MB (6.864e+10 bytes)

*  Limited by System Memory (physical + swap file) available.

4) The command I am running is 'JRC detect' on the loaded PRM file for the folder. The system will run through the first ~10 files before generating that error. When I use 'JRC spikesort' it will run to ~18th file before generating the same error

5) The data folder that I am accessing with the .prm is only 1.02G, so it is definitely not a size issue it seems.

Thanks again, Ryan

aliddell commented 6 years ago

Hi @RyanLoh2 -- OP is encountering this error from the GUI and it looks like you're running the CLI, so your tracebacks will be different. Can you post the exact output when you get this error?

RyanLoh2 commented 5 years ago

Sure. When I run detect() through the GUI, this is the output:

Running 'D:\Projects\Users\Ryan\MATLAB\JRCLUST\jrc3.m'
Auto-set: maxSite=3.0, nSites_ref=2.0
File 1/60: detecting spikes from .\719_run_02_g0_t0.nidq.bin
Processing 1/1 of file 1/60...
    Loading from file...took 0.1s
    Filtering spikes... took 1.4s
    Detecting spikes from each channel.
        ................................
        Detected 67 spikes from 32 sites; took 0.5s.
    Merging spikes...Starting parallel pool (parpool) using the 'local' profile ... connected to 10 workers.
    26 spiking events found; took 32.3s
    Extracting features...  took 0.9s
File 1/60 took 35.4s (14.0 MB, 0.4 MB/s, x0.2 realtime)
File 2/60: detecting spikes from .\719_run_02_g0_t1.nidq.bin
Processing 1/1 of file 2/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 18 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 2/60 took 0.4s (14.0 MB, 33.2 MB/s, x16.6 realtime)
File 3/60: detecting spikes from .\719_run_02_g0_t2.nidq.bin
Processing 1/1 of file 3/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 99 spikes from 32 sites; took 0.1s.
    Merging spikes...   37 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 3/60 took 0.5s (14.0 MB, 30.6 MB/s, x15.3 realtime)
File 4/60: detecting spikes from .\719_run_02_g0_t3.nidq.bin
Processing 1/1 of file 4/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 27 spikes from 32 sites; took 0.1s.
    Merging spikes...   16 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 4/60 took 0.4s (14.0 MB, 38.1 MB/s, x19.0 realtime)
File 5/60: detecting spikes from .\719_run_02_g0_t4.nidq.bin
Processing 1/1 of file 5/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 18 spikes from 32 sites; took 0.1s.
    Merging spikes...   5 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 5/60 took 0.3s (14.0 MB, 40.7 MB/s, x20.3 realtime)
File 6/60: detecting spikes from .\719_run_02_g0_t5.nidq.bin
Processing 1/1 of file 6/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 22 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 6/60 took 0.3s (14.0 MB, 42.4 MB/s, x21.2 realtime)
File 7/60: detecting spikes from .\719_run_02_g0_t6.nidq.bin
Processing 1/1 of file 7/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 9 spikes from 32 sites; took 0.0s.
    Merging spikes...   3 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 7/60 took 0.3s (14.0 MB, 46.9 MB/s, x23.4 realtime)
File 8/60: detecting spikes from .\719_run_02_g0_t7.nidq.bin
Processing 1/1 of file 8/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 27 spikes from 32 sites; took 0.1s.
    Merging spikes...   8 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 8/60 took 0.5s (14.0 MB, 30.0 MB/s, x15.0 realtime)
File 9/60: detecting spikes from .\719_run_02_g0_t8.nidq.bin
Processing 1/1 of file 9/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 32 spikes from 32 sites; took 0.1s.
    Merging spikes...   11 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 9/60 took 0.4s (14.0 MB, 39.7 MB/s, x19.9 realtime)
File 10/60: detecting spikes from .\719_run_02_g0_t9.nidq.bin
Processing 1/1 of file 10/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 16 spikes from 32 sites; took 0.1s.
    Merging spikes...   6 spiking events found; took 0.0s
    Extracting features...  took 0.0s
File 10/60 took 0.3s (14.0 MB, 46.0 MB/s, x23.0 realtime)
File 11/60: detecting spikes from .\719_run_02_g0_t10.nidq.bin
Processing 1/1 of file 11/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 1 spikes from 32 sites; took 0.0s.
    Merging spikes...   1 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 11/60 took 0.3s (14.0 MB, 45.5 MB/s, x22.7 realtime)
File 12/60: detecting spikes from .\719_run_02_g0_t11.nidq.bin
Processing 1/1 of file 12/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 108 spikes from 32 sites; took 0.1s.
    Merging spikes...   29 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 12/60 took 0.5s (14.0 MB, 27.0 MB/s, x13.5 realtime)
File 13/60: detecting spikes from .\719_run_02_g0_t12.nidq.bin
Processing 1/1 of file 13/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 102 spikes from 32 sites; took 0.1s.
    Merging spikes...   26 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 13/60 took 0.4s (14.0 MB, 33.1 MB/s, x16.6 realtime)
File 14/60: detecting spikes from .\719_run_02_g0_t13.nidq.bin
Processing 1/1 of file 14/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 83 spikes from 32 sites; took 0.1s.
    Merging spikes...   21 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 14/60 took 0.4s (14.0 MB, 36.2 MB/s, x18.1 realtime)
File 15/60: detecting spikes from .\719_run_02_g0_t14.nidq.bin
Processing 1/1 of file 15/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 53 spikes from 32 sites; took 0.1s.
    Merging spikes...   11 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 15/60 took 0.4s (14.0 MB, 35.8 MB/s, x17.9 realtime)
File 16/60: detecting spikes from .\719_run_02_g0_t15.nidq.bin
Processing 1/1 of file 16/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 63 spikes from 32 sites; took 0.1s.
    Merging spikes...   19 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 16/60 took 0.4s (14.0 MB, 35.8 MB/s, x17.9 realtime)
File 17/60: detecting spikes from .\719_run_02_g0_t16.nidq.bin
Processing 1/1 of file 17/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 26 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.0s
    Extracting features...  took 0.0s
File 17/60 took 0.3s (14.0 MB, 41.7 MB/s, x20.8 realtime)
File 18/60: detecting spikes from .\719_run_02_g0_t17.nidq.bin
Processing 1/1 of file 18/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 0 spikes from 32 sites; took 0.0s.
    Merging spikes...   0 spiking events found; took 0.1s
> In D:\Projects\Users\Ryan\MATLAB\JRCLUST\jrc3_gui.m>disperr_ (line 487)
  In D:\Projects\Users\Ryan\MATLAB\JRCLUST\jrc3_gui.m>btnDetect_Callback (line 324)
  In C:\Program Files\MATLAB\R2016b\toolbox\matlab\guide\gui_mainfcn.m>gui_mainfcn (line 95)
  In D:\Projects\Users\Ryan\MATLAB\JRCLUST\jrc3_gui.m>jrc3_gui (line 42)
  In C:\Program Files\MATLAB\R2016b\toolbox\matlab\graphics\+matlab\+graphics\+internal\+figfile\@FigFile\read.m>@(hObject,eventdata)jrc3_gui('btnDetect_Callback',hObject,eventdata,guidata(hObject))
Output argument "fGpu" (and maybe others) not assigned during call to "jrc3>wav2spk_".

and running it through the CLI results in the following:

>> jrc detect
Running 'D:\Projects\Users\Ryan\MATLAB\JRCLUST\jrc3.m'
Working on D:\Projects\Users\Ryan\Data\719\Ephys\719_run_02_g0_Loh_32_Chronic_Whisper.prm
Auto-set: maxSite=3.0, nSites_ref=2.0
File 1/60: detecting spikes from .\719_run_02_g0_t0.nidq.bin
Processing 1/1 of file 1/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 67 spikes from 32 sites; took 0.1s.
    Merging spikes...   26 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 1/60 took 0.5s (14.0 MB, 29.3 MB/s, x14.7 realtime)
File 2/60: detecting spikes from .\719_run_02_g0_t1.nidq.bin
Processing 1/1 of file 2/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 18 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 2/60 took 0.3s (14.0 MB, 42.4 MB/s, x21.2 realtime)
File 3/60: detecting spikes from .\719_run_02_g0_t2.nidq.bin
Processing 1/1 of file 3/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 99 spikes from 32 sites; took 0.1s.
    Merging spikes...   37 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 3/60 took 0.4s (14.0 MB, 32.9 MB/s, x16.5 realtime)
File 4/60: detecting spikes from .\719_run_02_g0_t3.nidq.bin
Processing 1/1 of file 4/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 27 spikes from 32 sites; took 0.1s.
    Merging spikes...   16 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 4/60 took 0.3s (14.0 MB, 40.6 MB/s, x20.3 realtime)
File 5/60: detecting spikes from .\719_run_02_g0_t4.nidq.bin
Processing 1/1 of file 5/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 18 spikes from 32 sites; took 0.1s.
    Merging spikes...   5 spiking events found; took 0.0s
    Extracting features...  took 0.0s
File 5/60 took 0.3s (14.0 MB, 46.2 MB/s, x23.1 realtime)
File 6/60: detecting spikes from .\719_run_02_g0_t5.nidq.bin
Processing 1/1 of file 6/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 22 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.0s
    Extracting features...  took 0.0s
File 6/60 took 0.3s (14.0 MB, 43.5 MB/s, x21.8 realtime)
File 7/60: detecting spikes from .\719_run_02_g0_t6.nidq.bin
Processing 1/1 of file 7/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 9 spikes from 32 sites; took 0.0s.
    Merging spikes...   3 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 7/60 took 0.3s (14.0 MB, 49.1 MB/s, x24.5 realtime)
File 8/60: detecting spikes from .\719_run_02_g0_t7.nidq.bin
Processing 1/1 of file 8/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 27 spikes from 32 sites; took 0.1s.
    Merging spikes...   8 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 8/60 took 0.3s (14.0 MB, 41.5 MB/s, x20.8 realtime)
File 9/60: detecting spikes from .\719_run_02_g0_t8.nidq.bin
Processing 1/1 of file 9/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 32 spikes from 32 sites; took 0.1s.
    Merging spikes...   11 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 9/60 took 0.3s (14.0 MB, 40.6 MB/s, x20.3 realtime)
File 10/60: detecting spikes from .\719_run_02_g0_t9.nidq.bin
Processing 1/1 of file 10/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 16 spikes from 32 sites; took 0.1s.
    Merging spikes...   6 spiking events found; took 0.0s
    Extracting features...  took 0.0s
File 10/60 took 0.3s (14.0 MB, 45.9 MB/s, x23.0 realtime)
File 11/60: detecting spikes from .\719_run_02_g0_t10.nidq.bin
Processing 1/1 of file 11/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 1 spikes from 32 sites; took 0.0s.
    Merging spikes...   1 spiking events found; took 0.1s
    Extracting features...  took 0.0s
File 11/60 took 0.3s (14.0 MB, 55.4 MB/s, x27.7 realtime)
File 12/60: detecting spikes from .\719_run_02_g0_t11.nidq.bin
Processing 1/1 of file 12/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 108 spikes from 32 sites; took 0.1s.
    Merging spikes...   29 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 12/60 took 0.4s (14.0 MB, 33.3 MB/s, x16.6 realtime)
File 13/60: detecting spikes from .\719_run_02_g0_t12.nidq.bin
Processing 1/1 of file 13/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 102 spikes from 32 sites; took 0.1s.
    Merging spikes...   26 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 13/60 took 0.4s (14.0 MB, 33.1 MB/s, x16.6 realtime)
File 14/60: detecting spikes from .\719_run_02_g0_t13.nidq.bin
Processing 1/1 of file 14/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 83 spikes from 32 sites; took 0.1s.
    Merging spikes...   21 spiking events found; took 0.0s
    Extracting features...  took 0.1s
File 14/60 took 0.4s (14.0 MB, 35.4 MB/s, x17.7 realtime)
File 15/60: detecting spikes from .\719_run_02_g0_t14.nidq.bin
Processing 1/1 of file 15/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 53 spikes from 32 sites; took 0.1s.
    Merging spikes...   11 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 15/60 took 0.4s (14.0 MB, 36.9 MB/s, x18.5 realtime)
File 16/60: detecting spikes from .\719_run_02_g0_t15.nidq.bin
Processing 1/1 of file 16/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 63 spikes from 32 sites; took 0.1s.
    Merging spikes...   19 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 16/60 took 0.4s (14.0 MB, 35.2 MB/s, x17.6 realtime)
File 17/60: detecting spikes from .\719_run_02_g0_t16.nidq.bin
Processing 1/1 of file 17/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 26 spikes from 32 sites; took 0.1s.
    Merging spikes...   7 spiking events found; took 0.1s
    Extracting features...  took 0.1s
File 17/60 took 0.3s (14.0 MB, 40.8 MB/s, x20.4 realtime)
File 18/60: detecting spikes from .\719_run_02_g0_t17.nidq.bin
Processing 1/1 of file 18/60...
    Loading from file...took 0.0s
    Filtering spikes... took 0.0s
    Detecting spikes from each channel.
        ................................
        Detected 0 spikes from 32 sites; took 0.0s.
    Merging spikes...   0 spiking events found; took 0.0s
Output argument "fGpu" (and maybe others) not assigned during call to "jrc3>wav2spk_".

Error in jrc3>file2spk_ (line 13600)
        [tnWav_raw_, tnWav_spk_, trFet_spk_, miSite_spk{end+1}, viTime_spk{end+1}, vrAmp_spk{end+1},
        vnThresh_site{end+1}, P.fGpu] ...

Error in jrc3>detect_ (line 825)
S0 = file2spk_(P);

Error in jrc3 (line 134)
        detect_(P); describe_(P.vcFile_prm);

Error in jrc (line 6)
jrc3(varargin{:});
RyanLoh2 commented 5 years ago

I double checked that the specific file wasn't different, t18 is the exact same size as all the other files and has it's own meta file as the others do.

aliddell commented 5 years ago

Thanks for this. I see that JRCLUST detected no spikes in this batch (just like in the case of OP). It fails because if it detects no spikes, it returns before fGpu is set, so that's a bug.

I'll patch this in the master branch right away, but if you want to keep using v3.2.5, all you have to do move the statement

fGpu = P.fGpu

on line 13251 of jrc3.m to just beneath

[tnWav_spk_raw, tnWav_spk, trFet_spk, miSite_spk] = deal([]);

on line 13114. If you're familiar with patches, here's the patch:

diff --git a/jrc3.m b/jrc3.m
index b9c3193..6efed23 100644
--- a/jrc3.m
+++ b/jrc3.m
@@ -13112,6 +13112,7 @@ if nargin<5, viSite_spk = []; end
 if nargin<6, mnWav1_pre = []; end
 if nargin<7, mnWav1_post = []; end
 [tnWav_spk_raw, tnWav_spk, trFet_spk, miSite_spk] = deal([]);
+fGpu = P.fGpu;
 nFet_use = get_set_(P, 'nFet_use', 2);
 fMerge_spk = 1; %debug purpose
 fShift_pos = 0; % shift center position based on center of mass
@@ -13248,7 +13249,6 @@ end
 if nPad_pre > 0, viTime_spk = viTime_spk - nPad_pre; end
 [viTime_spk, trFet_spk, miSite_spk, tnWav_spk] = ...
     gather_(viTime_spk, trFet_spk, miSite_spk, tnWav_spk);
-fGpu = P.fGpu;
 fprintf('\ttook %0.1fs\n', toc(t_fet));
 end %func

Let me know if this works for you.

RyanLoh2 commented 5 years ago

This appears to have solved the issue. Thanks!

aliddell commented 5 years ago

Glad to hear it!