X-Git-Url: http://git.tremily.us/?p=hooke.git;a=blobdiff_plain;f=hooke%2Fdriver%2Fjpk.py;h=ee78f35350e6011e4e9825cad028d36e69029a6b;hp=c75fad31e7ae994cf16a3a34e207ec36404a0c42;hb=a329c4f3bbd0436fcad10f8509b78d08ac790998;hpb=f48090612f9d825da5b3090d406a927a3b46a5b8 diff --git a/hooke/driver/jpk.py b/hooke/driver/jpk.py index c75fad3..ee78f35 100644 --- a/hooke/driver/jpk.py +++ b/hooke/driver/jpk.py @@ -101,17 +101,26 @@ class JPKDriver (Driver): prop_file.close() expected_shape = (int(prop['force-segment-header']['num-points']),) channels = [] + if 'list' not in prop['channels']: + prop['channels'] = {'list': prop['channels'].split()} for chan in prop['channels']['list']: chan_info = prop['channel'][chan] - channels.append(self._zip_channel(zipfile, index, chan, chan_info)) + channels.append(self._zip_channel( + zipfile, index, chan, chan_info)) if channels[-1].shape != expected_shape: - raise NotImplementedError( - 'Channel %d:%s in %s has strange shape %s != %s' - % (index, chan, zipfile.path, - channels[-1].shape, expected_shape)) + raise NotImplementedError( + 'Channel %d:%s in %s has strange shape %s != %s' + % (index, chan, zipfile.path, + channels[-1].shape, expected_shape)) + if len(channels) > 0: + shape = (len(channels[0]), len(channels)) + dtype = channels[0].dtype + else: # no channels for this data block + shape = (0,0) + dtype = numpy.float32 d = curve.Data( - shape=(len(channels[0]), len(channels)), - dtype=channels[0].dtype, + shape=shape, + dtype=dtype, info=self._zip_translate_segment_params(prop)) for i,chan in enumerate(channels): d[:,i] = chan