Fix problems with the transition to the new nested-Config h5config package.
[calibcant.git] / calibcant / vib.py
index 608b9b0db4d8e307c948fdff90bb941d0f0245a2..0c71f079e7510f7ec19a6a810d575c4ed9a2b2dc 100644 (file)
@@ -114,13 +114,12 @@ def vib(piezo, vibration_config, filename, group='/'):
     >>> channel.range = channel.find_range(
     ...     unit=UNIT.volt, min=-10, max=10)
     >>> channel_config = ChannelConfig()
+    >>> channel_config['name'] = 'deflection'
 
-    >>> c = InputChannel(
-    ...     channel_config=channel_config, channel=channel,
-    ...     name='deflection')
+    >>> c = InputChannel(config=channel_config, channel=channel)
     >>> c.setup_config()
 
-    >>> piezo = AFMPiezo(axes=[], input_channels=[c])
+    >>> piezo = AFMPiezo(axes=[], inputs=[c])
 
     Test a vibration:
 
@@ -132,39 +131,40 @@ def vib(piezo, vibration_config, filename, group='/'):
       /vibration
         /vibration/config
           /vibration/config/deflection
-            /vibration/config/deflection/channel
-              <HDF5 dataset "channel": shape (), type "|S1">
-                0
-              <HDF5 dataset "conversion-coefficients": shape (), type "|S24">
-                -10.0, 0.000305180437934
-              <HDF5 dataset "conversion-origin": shape (), type "|S3">
-                0.0
-              <HDF5 dataset "device": shape (), type "|S12">
-                /dev/comedi0
-              <HDF5 dataset "inverse-conversion-coefficients": shape (), type "|S12">
-                0.0, 3276.75
-              <HDF5 dataset "inverse-conversion-origin": shape (), type "|S5">
-                -10.0
-              <HDF5 dataset "maxdata": shape (), type "|S5">
-                65535
-              <HDF5 dataset "range": shape (), type "|S1">
-                0
-              <HDF5 dataset "subdevice": shape (), type "|S1">
-                0
+            <HDF5 dataset "channel": shape (), type "<i4">
+              0
+            <HDF5 dataset "conversion-coefficients": shape (2,), type "<f8">
+              [ -1.00000000e+01   3.05180438e-04]
+            <HDF5 dataset "conversion-origin": shape (), type "<f8">
+              0.0
+            <HDF5 dataset "device": shape (), type "|S12">
+              /dev/comedi0
+            <HDF5 dataset "inverse-conversion-coefficients": shape (2,), type "<f8">
+              [    0.    3276.75]
+            <HDF5 dataset "inverse-conversion-origin": shape (), type "<f8">
+              -10.0
+            <HDF5 dataset "maxdata": shape (), type "<i8">
+              65535
+            <HDF5 dataset "name": shape (), type "|S10">
+              deflection
+            <HDF5 dataset "range": shape (), type "<i4">
+              0
+            <HDF5 dataset "subdevice": shape (), type "<i4">
+              0
           /vibration/config/vibration
-            <HDF5 dataset "chunk-size": shape (), type "|S4">
+            <HDF5 dataset "chunk-size": shape (), type "<i4">
               2048
-            <HDF5 dataset "frequency": shape (), type "|S7">
+            <HDF5 dataset "frequency": shape (), type "<f8">
               50000.0
-            <HDF5 dataset "maximum-fit-frequency": shape (), type "|S7">
+            <HDF5 dataset "maximum-fit-frequency": shape (), type "<f8">
               25000.0
-            <HDF5 dataset "minimum-fit-frequency": shape (), type "|S5">
+            <HDF5 dataset "minimum-fit-frequency": shape (), type "<f8">
               500.0
             <HDF5 dataset "model": shape (), type "|S12">
               Breit-Wigner
-            <HDF5 dataset "overlap": shape (), type "|S2">
-              no
-            <HDF5 dataset "sample-time": shape (), type "|S1">
+            <HDF5 dataset "overlap": shape (), type "|b1">
+              False
+            <HDF5 dataset "sample-time": shape (), type "<i4">
               1
             <HDF5 dataset "window": shape (), type "|S4">
               Hann
@@ -184,7 +184,7 @@ def vib(piezo, vibration_config, filename, group='/'):
     """
     deflection_input_channel = piezo.input_channel_by_name('deflection')
     
-    deflection_channel_config = deflection_input_channel.channel_config
+    deflection_channel_config = deflection_input_channel.config
 
     deflection = vib_acquire(piezo, vibration_config)
     variance = _vib_analyze(