From: W. Trevor King Date: Tue, 4 Oct 2011 15:41:42 +0000 (-0400) Subject: Update calib_analyze_all for nested Configs. X-Git-Tag: 0.7~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=436b4a0912f16ba8df288c3bd69528bd778e6017;p=calibcant.git Update calib_analyze_all for nested Configs. Also wrap `figure.show` calls to avoid calling them when using Matplotlib backends that do not support that method (e.g. Cairo). --- diff --git a/calibcant/T_analyze.py b/calibcant/T_analyze.py index f7a92e3..db63da2 100644 --- a/calibcant/T_analyze.py +++ b/calibcant/T_analyze.py @@ -165,4 +165,5 @@ def T_plot(raw_T=None, processed_T=None): if axes2: axes2.set_title('Processed Temperatures %s' % timestamp) axes2.plot(processed_T, label='processed') - figure.show() + if hasattr(figure, 'show'): + figure.show() diff --git a/calibcant/analyze.py b/calibcant/analyze.py index dcfc747..4fe5d72 100644 --- a/calibcant/analyze.py +++ b/calibcant/analyze.py @@ -337,7 +337,8 @@ def calib_plot(bumps, temperatures, vibrations): vib_axes.plot(vibrations, 'b.-') vib_axes.set_ylabel('thermal deflection variance (V^2)') - figure.show() + if hasattr(figure, 'show'): + figure.show() def calib_load_all(filename, group='/'): @@ -399,12 +400,11 @@ def calib_analyze_all(filename, group='/', maximum_relative_error=1e-5, changed_bump = changed_temperature = changed_vibration = False for i in range(calibration_config['num-bumps']): bump_group = '%sbump/%d/' % (group, i) - (raw_bump,bump_config,z_channel_config,z_axis_config, + (raw_bump,bump_config,z_axis_config, deflection_channel_config,processed_bump) = _bump_load( filename=filename, group=bump_group) sensitivity = _bump_analyze( data=raw_bump, bump_config=bump_config, - z_channel_config=z_channel_config, z_axis_config=z_axis_config, deflection_channel_config=deflection_channel_config) bumps[i] = sensitivity @@ -491,7 +491,6 @@ def calib_plot_all(bumps, bump_details, temperatures, temperature_details, for i,bump in enumerate(bump_details): sensitivity = _bump_analyze( data=bump['raw_bump'], bump_config=bump['bump_config'], - z_channel_config=bump['z_channel_config'], z_axis_config=bump['z_axis_config'], deflection_channel_config=bump['deflection_channel_config'], plot=True) diff --git a/calibcant/bump_analyze.py b/calibcant/bump_analyze.py index 5890f70..ce2e278 100644 --- a/calibcant/bump_analyze.py +++ b/calibcant/bump_analyze.py @@ -466,4 +466,5 @@ def bump_plot(data, yguess=None, yfit=None): #residual_axes.legend(loc='upper right') residual_axes.set_xlabel('Z piezo (meters)') residual_axes.set_ylabel('Photodiode (Volts)') - figure.show() + if hasattr(figure, 'show'): + figure.show() diff --git a/calibcant/vib_analyze.py b/calibcant/vib_analyze.py index bf74558..8c6791e 100644 --- a/calibcant/vib_analyze.py +++ b/calibcant/vib_analyze.py @@ -571,5 +571,5 @@ def vib_plot(deflection=None, freq_axis=None, power=None, A=None, B=None, freq_axes.axis([xmin,xmax,ymin,ymax]) freq_axes.set_xlabel('frequency (Hz)') freq_axes.set_ylabel('PSD') - - figure.show() + if hasattr(figure, 'show'): + figure.show()