return '%s %s' % (
self.param_format_string % tuple(params), hist_params)
- def _residual(self, params):
+ def residual(self, params):
residual = 0
for hist_params,experiment_hist in self.experiment_histograms.iteritems():
sawsim_hist = sawsim_histogram(
self._plot_residual_comparison(
experiment_hist, sawsim_hist, residual=r,
title=title, filename=filename)
- log().debug('residual: %g' % residual)
+ log().debug('residual %s: %g' % (params, residual))
return residual
def plot(self, param_ranges, logx=False, logy=False, contour=False):
log().info('point %d %d (%d of %d)'
% (i, j, i*(len(y)-1) + j, (len(x)-1)*(len(y)-1)))
params = (xi,yj)
- r = self._residual(params)
+ r = self.residual(params)
C[j,i] = numpy.log(r) # better resolution in valleys
if MEM_DEBUG == True:
log().debug('RSS: %d KB' % rss())
>>> parse_param_ranges_string('[1,2,3],[4,5,6]')
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]
+ >>> parse_param_ranges_string('[1,2,3]')
+ [[1.0, 2.0, 3.0]]
"""
ranges = []
for range_string in string.split("],["):
metavar="PARAMS",
help="Param range for plotting (%default).",
default='[1e-5,1e-3,20],[0.1e-9,1e-9,20]')
- parser.add_option("-R","--residual", dest="residual",
- metavar="STRING",
- help="Residual type (from 'jensen-shannon', 'chi-squared', 'mean', 'std-dev'; default: %default).",
- default='jensen-shannon')
- parser.add_option("-P","--plot-residuals", dest="plot_residuals",
- help="Generate residual difference plots for each point in the plot range.",
- default=False, action="store_true")
parser.add_option("--logx", dest="logx",
help="Use a log scale for the x range.",
default=False, action="store_true")
parser.add_option("--logy", dest="logy",
help="Use a log scale for the y range.",
default=False, action="store_true")
+ parser.add_option("-R","--residual", dest="residual",
+ metavar="STRING",
+ help="Residual type (from %s; default: %%default)."
+ % ', '.join(Histogram().types()),
+ default='jensen-shannon')
+ parser.add_option("-P","--plot-residuals", dest="plot_residuals",
+ help="Generate residual difference plots for each point in the plot range.",
+ default=False, action="store_true")
parser.add_option("-c","--contour-plot", dest="contour_plot",
help="Select contour plot (vs. the default pseudocolor plot).",
default=False, action="store_true")