Update calib_analyze_all for nested Configs.
authorW. Trevor King <wking@drexel.edu>
Tue, 4 Oct 2011 15:41:42 +0000 (11:41 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 4 Oct 2011 15:41:46 +0000 (11:41 -0400)
Also wrap `figure.show` calls to avoid calling them when using
Matplotlib backends that do not support that method (e.g. Cairo).

calibcant/T_analyze.py
calibcant/analyze.py
calibcant/bump_analyze.py
calibcant/vib_analyze.py

index f7a92e3662ed188a2fe91dbbfed364eca087ebbd..db63da2ff4bf5f47acea172f891267ee05579d1b 100644 (file)
@@ -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()
index dcfc7471304426f2b58df0b23e182f9860859e9f..4fe5d72dcfe070aa95c364acef8a630dd82c41e3 100644 (file)
@@ -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)
index 5890f70f4d02de9e8c8b0bb97c2ac625fae24bdf..ce2e27831046489bd3339486909ab0f53c87ee81 100644 (file)
@@ -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()
index bf7455839e3226a6187a8da5f948a9461a80184d..8c6791e20aae3e9e71fc9020bf73f3198a516ea5 100644 (file)
@@ -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()