From f1f419f1aad9327ad952e971e4d9b63c4c169740 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 20 Oct 2010 03:30:27 -0400 Subject: [PATCH] Add --clean-cache option to velocity_dependant_scan.main(). --- pysawsim/velocity_dependant_scan.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pysawsim/velocity_dependant_scan.py b/pysawsim/velocity_dependant_scan.py index 787d5e2..caf3d30 100644 --- a/pysawsim/velocity_dependant_scan.py +++ b/pysawsim/velocity_dependant_scan.py @@ -61,7 +61,7 @@ class HistogramMatcher (object): """ def __init__(self, velocity_stream, param_format_string, N=400, manager=None, residual_type='jensen-shannon', plot=True, - use_cache=False): + use_cache=False, clean_cache=False): self.experiment_histograms = self.read_force_histograms(velocity_stream) self.param_format_string = param_format_string self.residual_type = residual_type @@ -69,7 +69,7 @@ class HistogramMatcher (object): self._manager = manager self.plot = plot self.sawsim_histogram = sawsim_histogram.SawsimHistogram( - use_cache=self.use_cache) + use_cache=use_cache, clean_cach=clean_cache) def read_force_histograms(self, stream): """ @@ -243,9 +243,12 @@ def main(): help="Job manager name (one of %s) (%%default)." % (', '.join(MANAGERS)), default=MANAGERS[0]) - parser.add_option("-C","--use_cache", dest="use_cache", + parser.add_option("-C","--use-cache", dest="use_cache", help="Use cached simulations if they exist (vs. running new simulations) (%default)", default=False, action="store_true") + parser.add_option("--clean-cache", dest="clean_cache", + help="Remove previously cached simulations if they exist (%default)", + default=False, action="store_true") parser.add_option("-d","--cache-dir", dest="cache_dir", metavar="STRING", help="Cache directory for sawsim unfolding forces (%default).", @@ -277,7 +280,8 @@ def main(): 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) + 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) -- 2.26.2