Last active
October 11, 2015 07:30
-
-
Save npyoung/a2d9784929716225fc24 to your computer and use it in GitHub Desktop.
Convert a Tucker-Davis Technologies (TDT) to Neo's HDF5 format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from os.path import join as pjoin | |
from os.path import isdir | |
from os import listdir | |
from argparse import ArgumentParser | |
from neo.io import TdtIO, NeoHdf5IO | |
from progressbar import ProgressBar | |
if __name__ == '__main__': | |
parser = ArgumentParser(description="Convert a Tucker-Davis Technologies (TDT) to Neo's HDF5 format.") | |
parser.add_argument('datatank', type=str, help="Path to the DataTank root") | |
parser.add_argument('output', type=str, help="Path to the h5 file you want to create") | |
args = parser.parse_args() | |
tank = TdtIO(filename=args.datatank) | |
h5file = NeoHdf5IO(filename=args.output) | |
segment_names = [name for name in listdir(args.datatank) if isdir(pjoin(args.datatank, name))] | |
for segment_name in ProgressBar()(segment_names): | |
h5file.write_segment(tank.read_segment(segment_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes NeuralEnsemble/python-neo#213 gets merged. Doing this by the whole block (as opposed to segment-by-segment) will likely run you out of memory.