open-ephys / open-ephys-python-tools

Python code for interacting with the Open Ephys GUI
MIT License
29 stars 18 forks source link

Packing openephys files into .dat #23

Open jofrony opened 1 year ago

jofrony commented 1 year ago

Hi,

I am using Open Ephys with Neuronexus probes. We have previously used the archive code to pack our Open Ephys files into .dat file which is required by Kilosort. Is this function available in these tools or are there other ways to do it?

medengineer commented 1 year ago

Hi,

Yes, you just need to load the continuous[0].samples and call np.tofile on that array.

jsiegle commented 1 year ago

For example, for the data in the first data stream saved by the first record node, this is the code you'd need:

from open_ephys.analysis import Session

session = Session('/path/to/data/directory')
data = session.recordnodes[0].recordings[0].continuous[0].samples
data = data.astype('int16') # convert to 16-bit integers before export
data.tofile('continuous.dat') # write samples to a .dat file