Oops, analyze_all's data argument is a dict, not an hdf5 group.
authorW. Trevor King <wking@tremily.us>
Fri, 11 May 2012 16:34:03 +0000 (12:34 -0400)
committerW. Trevor King <wking@tremily.us>
Fri, 11 May 2012 16:34:03 +0000 (12:34 -0400)
calibcant/analyze.py

index a8dda107074df8552f25d6a62c6d39d783156ed2..625ae4caec931ac0578faa0d1069e821fb776ee6 100644 (file)
@@ -238,7 +238,7 @@ def analyze_all(config, data, raw_data, maximum_relative_error=1e-5,
     else:
         f = None
     try:
-        if len(data.get('raw/bump', [])) != len(data['bump']):
+        if len(data.get('raw', {}).get('bump', [])) != len(data['bump']):
             bumps_changed = True
         for i,bump in enumerate(raw_data['bump']):
             data['bump'][i],changed = check_bump(
@@ -249,7 +249,8 @@ def analyze_all(config, data, raw_data, maximum_relative_error=1e-5,
                 bumps_changed = True
                 bump_group = _h5_create_group(group, 'bump/{}'.format(i))
                 _bump_save(group=bump_group, processed=data['bump'][i])
-        if len(data.get('raw/temperature', [])) != len(data['temperature']):
+        if len(data.get('raw', {}).get('temperature', [])
+               ) != len(data['temperature']):
             temperatures_changed = True
         for i,temperature in enumerate(raw_data['temperature']):
             data['temperature'][i],changed = check_temperature(
@@ -261,7 +262,8 @@ def analyze_all(config, data, raw_data, maximum_relative_error=1e-5,
                     group, 'temperature/{}'.format(i))
                 _temperature_save(
                     group=temerature_group, processed=data['temperature'][i])
-        if len(data.get('raw/vibration', [])) != len(data['vibration']):
+        if len(data.get('raw', {}).get('vibration', [])
+               ) != len(data['vibration']):
             vibrations_changed = True
         for i,vibration in enumerate(raw_data['vibration']):
             data['vibration'][i],changed = check_vibration(
@@ -299,8 +301,9 @@ def analyze_all(config, data, raw_data, maximum_relative_error=1e-5,
                 'not enough raw vibration data: {} of {}'.format(
                     len(raw_data['vibration']), len(data['vibration'])))
         k,k_s,changed = check_calibration(
-            k=data.get('processed/spring_constant', None),
-            k_s=data.get('processed/spring_constant_deviation', None),
+            k=data.get('processed', {}).get('spring_constant', None),
+            k_s=data.get('processed', {}).get(
+                'spring_constant_deviation', None),
             bumps=data['bump'],
             temperatures=data['temperature'], vibrations=data['vibration'],
             maximum_relative_error=maximum_relative_error)