Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions neo/io/tdtio.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -244,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
Expand Down