From: W. Trevor King Date: Fri, 2 Mar 2012 18:57:14 +0000 (-0500) Subject: Allow calib_analyze_all to run when there are no previous analyzed bumps, etc. X-Git-Tag: 0.8~31 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c892b157772015b4834771780593a712128b6bb7;p=calibcant.git 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. --- 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)