Here's the data
# Fluence.... -sigma Signal... -sigma area
1127 48.32 9.114 10.31 0.1318
1.127e+04 482.9 35.96 16.15 0.4994
1.127e+05 4829 231.2 101.1 2.568
1.127e+06 4.829e+04 4631 1689 12.22
And here's the ploting tool source code (also used for generating the
linked PDF).
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# vim: filetype python
import sys, os, argparse
import math, numpy, scipy, scipy.optimize
import matplotlib, matplotlib.cm
import matplotlib.pyplot as pyplot
import pylab
def expmodel(p, x):
return p[0] + numpy.exp(p[1]*x)*p[2]
def experror(p, x, y):
return y - expmodel(p, x)
def linmodel(p, x):
return p[0] + p[1]*x
def linerror(p, x, y):
return y - linmodel(p, x)
if __name__ == '__main__':
optparse = argparse.ArgumentParser(description='plot raddark dat files with errorbars and linear or exponential model regression plots', prog=sys.argv[0])
optparse.add_argument('--xlabel', type=str, default='Particle Count')
optparse.add_argument('--ylabel', type=str, default='Signal')
optparse.add_argument('--title', type=str, default='')
optparse.add_argument('--outlier', '-O', action='append', type=str)
optfitgrp = optparse.add_mutually_exclusive_group()
optfitgrp.add_argument('--exp', '-e', action='store_true')
optfitgrp.add_argument('--lin', '-l', action='store_true')
optparse.add_argument('--log', action='store_true')
optparse.add_argument('files', type=str, nargs='+')
options = optparse.parse_args(sys.argv[1:])
data = [ numpy.loadtxt(filename) for filename in options.files ]
if options.outlier:
outlier = [ numpy.loadtxt(filename) for filename in options.outlier ]
ax = pyplot.subplot(1,1,1)
if options.log:
ax.loglog()
ax.set_title(options.title)
ax.set_xlabel(options.xlabel)
ax.set_ylabel(options.ylabel)
ax.grid(True, 'both')
for f,d in zip(options.files, data):
ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], fmt='o', label=f)
if options.outlier:
for f,d in zip(options.outlier, outlier):
ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], fmt='+', label=f)
if options.exp or options.lin:
data_xs = numpy.concatenate( [ d[..., 0] for d in data ] )
data_ys = numpy.concatenate( [ d[..., 2] for d in data ] )
if options.outlier:
x_max = numpy.nanmax( numpy.concatenate((data_xs, numpy.concatenate([ o[..., 0] for o in outlier ]))) )
x_min = numpy.nanmin( numpy.concatenate((data_xs, numpy.concatenate([ o[..., 0] for o in outlier ]))) )
else:
x_max = numpy.nanmax(data_xs)
x_min = numpy.nanmin(data_xs)
x_ptp = x_max - x_min
xs = numpy.arange(x_min - 0.05*x_ptp, x_max + 0.05*x_ptp, x_ptp/10000.)
if options.exp:
p = scipy.optimize.leastsq(experror, [numpy.nanmin(data_ys), 1e-6/x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, data_ys))
ys = expmodel(p[0], xs)
if options.lin:
p = scipy.optimize.leastsq(linerror, [numpy.nanmin(data_ys), 1./x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, data_ys))
ys = linmodel(p[0], xs)
ax.plot(xs, ys, label="fit")
ax.legend(loc='upper left')
pyplot.show()
···
On Fri, 9 Mar 2012 11:19:15 -0600 Benjamin Root <ben.root@...1304...> wrote:
Can I have the data you used to produce these errorbars so I can test
this bug?