Pass velocity_dependant_scan.main() --manager through to SawsimHistogram.
authorW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 07:16:11 +0000 (03:16 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 20 Oct 2010 07:16:11 +0000 (03:16 -0400)
pysawsim/velocity_dependant_scan.py

index c54cf29d9f5be6ccbe0db28ce5fd528276e59af8..764c03ca6e3820aea6294ffb427ccdcbada3f3bd 100644 (file)
@@ -60,11 +60,13 @@ class HistogramMatcher (object):
     The main entry points are `fit()` and `plot()`.
     """
     def __init__(self, velocity_stream, param_format_string, N=400,
-                 residual_type='jensen-shannon', plot=True, use_cache=False):
+                 manager=None, residual_type='jensen-shannon', plot=True,
+                 use_cache=False):
         self.experiment_histograms = self.read_force_histograms(velocity_stream)
         self.param_format_string = param_format_string
         self.residual_type = residual_type
         self.N = N
+        self._manager = manager
         self.plot = plot
         self.sawsim_histogram = sawsim_histogram.SawsimHistogram(
             use_cache=self.use_cache)
@@ -118,7 +120,7 @@ class HistogramMatcher (object):
         for velocity,experiment_hist in self.experiment_histograms.iteritems():
             sawsim_hist = self.sawsim_histogram(
                 param_string=self.param_string(params, velocity), N=self.N,
-                bin_edges=experiment_hist.bin_edges)
+                bin_edges=experiment_hist.bin_edges, manager=self._manager)
             r = experiment_histogram.residual(
                 sawsim_hist, type=self.residual_type)
             residual += r
@@ -270,10 +272,11 @@ def main():
     velocity_file = args[0]
 
     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, residual_type=options.residual,
+        N=options.N, manager=manager, residual_type=options.residual,
         plot=options.plot_residuals, use_cache=options.use_cache)
     #hm.fit(initial_params)
     hm.plot(param_ranges, logx=options.logx, logy=options.logy,