open-ephys-plugins / neuropixels-pxi

Open Ephys GUI plugin for interfacing with PXIe-based Neuropixels hardware
GNU General Public License v3.0
13 stars 19 forks source link

Concatenate two separate recordings #30

Closed lmontelisciani closed 1 year ago

lmontelisciani commented 1 year ago

Hi all,

I have two recording sessions, and I would like to combine all their files in one recording folder.

At the moment, I am trying to combine the continuous and timestamps of all the files that Open Ephys give to me (AP, LFP, NI_DAQmx ) in the most efficient way, but not sure I am doing it correctly.

Do you have any Python/Matlab code that can be used for this purpose?

Thanks in advance for any help.

Thank you!

jsiegle commented 1 year ago

For the timestamp files, you just need to call np.concatenate:

import numpy as np
t1 = np.load('/path1/timestamps.npy')
t2 = np.load('/path2/timestamps.npy')
np.save('/path3/timestamps.npy', np.concatenate((t1,t2)))

For the continuous files, you can use np.ndarray.tofile:

import numpy as np
c1 = np.memmap('/path1/continuous.dat', mode='r')
c2 = np.memmap('/path2/continuous.dat', mode='r')
f = open('/path3/continuous.dat', 'wb')
c1.tofile(f)
c2.tofile(f)
f.close()
lmontelisciani commented 1 year ago

Thanks a lot Josh!