From 4347569e6dd40e6f1d9802780ef3f52a3486aa69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corni=C3=ABl=20Joosse?= Date: Wed, 10 May 2017 13:32:05 +0200 Subject: [PATCH 1/2] Changed itertools.izip import to make it compattible with python 3. --- neo/io/tdtio.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/neo/io/tdtio.py b/neo/io/tdtio.py index d4418230e..cb0c246a8 100644 --- a/neo/io/tdtio.py +++ b/neo/io/tdtio.py @@ -24,7 +24,11 @@ import numpy as np import quantities as pq -import itertools + +try: + from itertools import izip as zip +except ImportError: # zip already exists without import in python 3.x + pass from neo.io.baseio import BaseIO from neo.core import Block, Segment, AnalogSignal, SpikeTrain, Event @@ -38,7 +42,7 @@ def get_chunks(sizes, offsets, big_array): # sizes are not!! # so need this (I really do not knwo why...): sizes = (sizes -10) * 4 # - all = np.concatenate([ big_array[o:o+s] for s, o in itertools.izip(sizes, offsets) ]) + all = np.concatenate([ big_array[o:o+s] for s, o in zip(sizes, offsets) ]) return all class TdtIO(BaseIO): From 1c293b279c368952cd66035b5f30e8f6636353e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corni=C3=ABl=20Joosse?= Date: Wed, 10 May 2017 15:23:29 +0200 Subject: [PATCH 2/2] Changed AnalogSignal name to decoded string, removed unsupported channel_index parameter. --- neo/io/tdtio.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/neo/io/tdtio.py b/neo/io/tdtio.py index cb0c246a8..624fdeabe 100644 --- a/neo/io/tdtio.py +++ b/neo/io/tdtio.py @@ -248,10 +248,9 @@ def read_segment(self, blockname=None, lazy=False, cascade=True, sortname=''): signal = get_chunks(tsq[mask3]['size'],tsq[mask3]['eventoffset'], sig_array).view(dt) anasig = AnalogSignal(signal = signal* pq.V, - name = '{0} {1}'.format(code, channel), + name = '{0} {1}'.format(signame, channel), sampling_rate = sr * pq.Hz, - t_start = (tsq[mask3]['timestamp'][0] - global_t_start) * pq.s, - channel_index = int(channel) + t_start = (tsq[mask3]['timestamp'][0] - global_t_start) * pq.s ) if lazy: anasig.lazy_shape = shape