Skip to content

Commit df0ac82

Browse files
committed
add batchsize ks2 option in pre-processing
1 parent 4f541d7 commit df0ac82

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ibllib/dsp/voltage.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def destripe(x, fs, tr_sel=None, neuropixel_version=1, butter_kwargs=None, k_kwa
210210
return x_
211211

212212

213-
def decompress_destripe_cbin(sr, output_file=None, h=None, wrot=None, append=False, nc_out=None):
213+
def decompress_destripe_cbin(sr, output_file=None, h=None, wrot=None, append=False, nc_out=None, ns2add=0):
214214
"""
215215
From a spikeglx Reader object, decompresses and apply ADC.
216216
Saves output as a flat binary file in int16
@@ -221,6 +221,8 @@ def decompress_destripe_cbin(sr, output_file=None, h=None, wrot=None, append=Fal
221221
:param wrot: (optional) whitening matrix [nc x nc] or amplitude scalar to apply to the output
222222
:param append: (optional, False) for chronic recordings, append to end of file
223223
:param nc_out: (optional, True) saves non selected channels (synchronisation trace) in output
224+
:param ns2add: (optional) for kilosort, adds padding samples at the end of the file so the total
225+
number of samples is a multiple of the batchsize
224226
:return:
225227
"""
226228
import pyfftw
@@ -285,6 +287,7 @@ def decompress_destripe_cbin(sr, output_file=None, h=None, wrot=None, append=Fal
285287
first_s += NBATCH - SAMPLES_TAPER * 2
286288
pbar.update(NBATCH / sr.fs)
287289
if last_s == sr.ns:
288-
# pad with last sample
290+
if ns2add > 0:
291+
np.tile(chunk[-1, :nc_out].astype(np.int16), (ns2add, 1)).tofile(fid)
289292
break
290293
pbar.close()

0 commit comments

Comments
 (0)