From: W. Trevor King Date: Tue, 26 Oct 2010 22:00:26 +0000 (-0400) Subject: Remove some more velocity-specific cruft from pysawsim/parameter_scan.py. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f0a664b41589b5f223582740e970bb7b9f8ff3ce;p=sawsim.git Remove some more velocity-specific cruft from pysawsim/parameter_scan.py. --- diff --git a/pysawsim/parameter_scan.py b/pysawsim/parameter_scan.py index 4e11c6a..377e210 100644 --- a/pysawsim/parameter_scan.py +++ b/pysawsim/parameter_scan.py @@ -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 - - ... + + # comment and blank lines ignored + #HISTOGRAM: + + #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)