Remove some more velocity-specific cruft from pysawsim/parameter_scan.py.
authorW. Trevor King <wking@drexel.edu>
Tue, 26 Oct 2010 22:00:26 +0000 (18:00 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 26 Oct 2010 22:00:26 +0000 (18:00 -0400)
pysawsim/parameter_scan.py

index 4e11c6ab97ccac0466b9dadeb7dd437ee81525f7..377e210ab15eb07e33320df2fe65a9ad0fa4f557 100644 (file)
@@ -146,7 +146,7 @@ class HistogramMatcher (object):
     unique to that experiment.
 
     >>> from .manager.thread import ThreadManager
-    >>> velocity_stream = StringIO(EXAMPLE_HISTOGRAM_FILE_CONTENTS)
+    >>> histogram_stream = StringIO(EXAMPLE_HISTOGRAM_FILE_CONTENTS)
     >>> param_format_string = (
     ...     '-s cantilever,hooke,0.05 -N1 '
     ...     '-s folded,null -N8 '
@@ -154,7 +154,7 @@ class HistogramMatcher (object):
     ...     '-k "folded,unfolded,bell,{%g,%g}" -q folded')
     >>> m = ThreadManager()
     >>> sr = SawsimRunner(sawsim='bin/sawsim', manager=m)
-    >>> hm = HistogramMatcher(velocity_stream, param_format_string, sr, N=3)
+    >>> hm = HistogramMatcher(histogram_stream, param_format_string, sr, N=3)
     >>> hm.plot([[1e-5,1e-3,3],[0.1e-9,1e-9,3]], logx=True, logy=False)
     >>> m.teardown()
     """
@@ -172,9 +172,13 @@ class HistogramMatcher (object):
     def _read_force_histograms(self, stream):
         """
         File format:
-        # comment and blank lines ignored
-        <velocity in m/s><whitespace><path to histogram file>
-        ...
+
+          # comment and blank lines ignored
+          #HISTOGRAM: <histogram-specific params>
+          <pysawsim.histogram.Histogram-compatible histogram>
+          #HISTOGRAM: <other histogram-specific params>
+          <another pysawsim.histogram.Histogram-compatible histogram>
+          ...
 
         >>> import sys
         >>> stream = StringIO(EXAMPLE_HISTOGRAM_FILE_CONTENTS)
@@ -233,20 +237,6 @@ class HistogramMatcher (object):
         return '%s %s' % (
             self.param_format_string % tuple(params), hist_params)
 
-    def get_all_unfolding_data(self, dirname, velocity_string):
-        datafile = os.path.join(dirname, "data_" + velocity_string)
-        return numpy.fromfile(datafile, sep=" ")
-
-        sawsim_histograms = {}
-        for velocity in velocities:
-            unfolding_forces = self.get_all_unfolding_data(dirname, str(velocity))
-            bin_edges = histograms[velocity].bin_edges
-            h = Histogram()
-            h.from_data(unfolding_forces, bin_edges)
-            sawsim_histograms[velocity] = h
-            sawsim_histograms[velocity].normalize()
-        return sawsim_histograms
-
     def _residual(self, params):
         residual = 0
         for hist_params,experiment_hist in self.experiment_histograms.iteritems():
@@ -421,12 +411,13 @@ def main(argv=None):
 
     initial_params = [float(p) for p in options.initial_params.split(",")]
     param_ranges = parse_param_ranges_string(options.param_range)
-    velocity_file = args[0]
+    histogram_file = args[0]
     sr_call_params = sr.initialize_from_options(options)
 
     try:
         hm = HistogramMatcher(
-            file(velocity_file, 'r'), param_format_string=options.param_format,
+            file(histogram_file, 'r'),
+            param_format_string=options.param_format,
             sawsim_runner=sr, residual_type=options.residual,
             plot=options.plot_residuals, **sr_call_params)
         #hm.fit(initial_params)