From c892b157772015b4834771780593a712128b6bb7 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 2 Mar 2012 13:57:14 -0500 Subject: [PATCH] Allow calib_analyze_all to run when there are no previous analyzed bumps, etc. This avoids: Traceback (most recent call last): ... File ".../calibcant/analyze.py", line 410, in calib_analyze_all bumps[i] = sensitivity TypeError: 'NoneType' object does not support item assignment which can happen if you construct the calibration datafile by hand and have not yet analyzed it with calibcant. --- calibcant/analyze.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/calibcant/analyze.py b/calibcant/analyze.py index f4e90dd..0b4c347 100644 --- a/calibcant/analyze.py +++ b/calibcant/analyze.py @@ -395,6 +395,12 @@ def calib_analyze_all(filename, group='/', maximum_relative_error=1e-5, assert group.endswith('/'), group bumps,temperatures,vibrations,calibration_config,k,k_s = calib_load( filename, group+'calibration/') + if bumps is None: + bumps = [None]*calibration_config['num-bumps'] + if temperatures is None: + temperatures = [None]*calibration_config['num-temperatures'] + if vibrations is None: + vibrations = [None]*calibration_config['num-vibrations'] changed_bump = changed_temperature = changed_vibration = False for i in range(calibration_config['num-bumps']): bump_group = '%sbump/%d/' % (group, i) -- 2.26.2