Teardown manager after use in velocity_dependant_scan.main().
authorW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 07:51:29 +0000 (03:51 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 07:51:29 +0000 (03:51 -0400)
pysawsim/velocity_dependant_scan.py

index caf3d3063deb5e4c069edecab3d01c541bbe4129..bb29272fcf6bfaf693ec117183d372f99aab7ff9 100644 (file)
@@ -276,12 +276,14 @@ def main():
 
     sawsim_histogram.CACHE_DIR = options.cache_dir
     manager = get_manager(options.manager)()
-
-    hm = HistogramMatcher(
-        file(velocity_file, 'r'), param_format_string=options.param_format,
-        N=options.N, manager=manager, residual_type=options.residual,
-        plot=options.plot_residuals, use_cache=options.use_cache,
-        clean_cache=options.clean_cache)
-    #hm.fit(initial_params)
-    hm.plot(param_ranges, logx=options.logx, logy=options.logy,
-            contour=options.contour_plot)
+    try:
+        hm = HistogramMatcher(
+            file(velocity_file, 'r'), param_format_string=options.param_format,
+            N=options.N, manager=manager, residual_type=options.residual,
+            plot=options.plot_residuals, use_cache=options.use_cache,
+            clean_cache=options.clean_cache)
+        #hm.fit(initial_params)
+        hm.plot(param_ranges, logx=options.logx, logy=options.logy,
+                contour=options.contour_plot)
+    finally:
+        manager.teardown()