Break JPK data block name extraction out into ._zip_segment_name().
authorW. Trevor King <wking@drexel.edu>
Wed, 8 Sep 2010 14:58:45 +0000 (10:58 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 8 Sep 2010 14:58:45 +0000 (10:58 -0400)
Also removes restrictions on allowed names.

hooke/driver/jpk.py

index 24d9777248d6e32f6cf20fd7d1468ed0bf367550..fec6cf523b01de9955de74f012c8da79ce90f50e 100644 (file)
@@ -174,19 +174,22 @@ class JPKDriver (Driver):
 
     def _zip_translate_segment_params(self, params):
         info = {
-            'raw info':params,
-            'columns':list(params['channels']['list']),
-            'name':params['force-segment-header']['name']['name'],
+            'raw info': params,
+            'columns': list(params['channels']['list']),
+            'name': self._zip_segment_name(params),
             }
-        if info['name'] in ['extend-spm', 'retract-spm', 'pause-at-end-spm']:
-            info['name'] = info['name'][:-len('-spm')]
-            if info['name'] == 'extend':
-                info['name'] = 'approach'
-        else:
-            raise NotImplementedError(
-                'Unrecognized segment type %s' % info['name'])
         return info
 
+    def _zip_segment_name(self, params):
+        name = params['force-segment-header']['name']['name']
+        if name.endswith('-spm'):
+            name = name[:-len('-spm')]
+        if name == 'extend':
+            name = 'approach'
+        elif name.startswith('pause-at-'):
+            name = 'pause'
+        return name
+
     def _zip_scale_segment(self, segment, path, info):
         data = curve.Data(
             shape=segment.shape,