Convert calibcant to the new, nestable h5config.
[calibcant.git] / calibcant / analyze.py
index d32e7faf72ee8fbb0cdc8a4067a0a097b8b52385..e29d6c70f0fb016ada5356b35d6f844352445da9 100644 (file)
@@ -44,13 +44,14 @@ Which are related by the parameters:
 >>> import os
 >>> import tempfile
 >>> import numpy
->>> from h5config.hdf5 import pprint_HDF5
->>> from .config import HDF5_CalibrationConfig
+>>> from h5config.storage.hdf5 import HDF5_Storage, pprint_HDF5
+>>> from .config import CalibrationConfig
 
 >>> fd,filename = tempfile.mkstemp(suffix='.h5', prefix='calibcant-')
 >>> os.close(fd)
 
->>> calibration_config = HDF5_CalibrationConfig(filename, '/calib/config/')
+>>> calibration_config = CalibrationConfig(storage=HDF5_Storage(
+...         filename=filename, group='/calib/config/'))
 >>> bumps = numpy.array((15.9e6, 16.9e6, 16.3e6))
 >>> temperatures = numpy.array((295, 295.2, 294.8))
 >>> vibrations = numpy.array((2.20e-5, 2.22e-5, 2.21e-5))
@@ -79,15 +80,21 @@ photodiode sensitivity (bumps).
 /
   /calib
     /calib/config
-      <HDF5 dataset "num-bumps": shape (), type "|S2">
+      <HDF5 dataset "bump": shape (), type "|S1">
+<BLANKLINE>
+      <HDF5 dataset "num-bumps": shape (), type "<i4">
         10
-      <HDF5 dataset "num-temperatures": shape (), type "|S2">
+      <HDF5 dataset "num-temperatures": shape (), type "<i4">
         10
-      <HDF5 dataset "num-vibrations": shape (), type "|S2">
+      <HDF5 dataset "num-vibrations": shape (), type "<i4">
         20
-      <HDF5 dataset "temperature-sleep": shape (), type "|S1">
+      <HDF5 dataset "temperature": shape (), type "|S1">
+<BLANKLINE>
+      <HDF5 dataset "temperature-sleep": shape (), type "<i4">
         1
-      <HDF5 dataset "vibration-spacing": shape (), type "|S5">
+      <HDF5 dataset "vibration": shape (), type "|S1">
+<BLANKLINE>
+      <HDF5 dataset "vibration-spacing": shape (), type "<f8">
         5e-05
     /calib/processed
       /calib/processed/spring-constant
@@ -140,14 +147,15 @@ except (ImportError, RuntimeError), e:
     _matplotlib = None
     _matplotlib_import_error = e
 
-from h5config.hdf5 import h5_create_group as _h5_create_group
+from h5config.storage.hdf5 import HDF5_Storage as _HDF5_Storage
+from h5config.storage.hdf5 import h5_create_group as _h5_create_group
 
 from . import LOG as _LOG
 from . import package_config as _package_config
 from .bump_analyze import bump_analyze as _bump_analyze
 from .bump_analyze import bump_load as _bump_load
 from .bump_analyze import bump_save as _bump_save
-from .config import HDF5_CalibrationConfig as _HDF5_CalibrationConfig
+from .config import CalibrationConfig as _CalibrationConfig
 from .T_analyze import T_analyze as _temperature_analyze
 from .T_analyze import T_load as _temperature_load
 from .T_analyze import T_save as _temperature_save
@@ -303,8 +311,8 @@ def calib_load(filename, group='/'):
             k_s = f[group+'processed/spring-constant/standard-deviation'][...]
         except KeyError:
             pass
-    calibration_config = _HDF5_CalibrationConfig(
-        filename=filename, group=group+'config/')
+    calibration_config = _CalibrationConfig(storage=_HDF5_Storage(
+            filename=filename, group=group+'config/'))
     calibration_config.load()
     return (bumps, temperatures, vibrations, calibration_config, k, k_s)