except ValueError, e:
        print "Skipping text values (%s)"%','.join(r)

# fit type
if options.func_name == "lognorm":
    func = lognormal_function.func()
elif options.func_name == "gauss":
    func = gauss_function.func()
elif options.func_name == "exp":
    func = exp_function.func()
elif options.func_name == "gamma":
    func = gamma_function.func()
elif options.func_name == "lin":
    func = lin_function.func()
else:
    func = doubleexp_function.func()
fr = function_fit(d, func, p0)

# fit results
print fr.fit()

# blank line
print
wrt = csv.writer(sys.stdout)
# output is outer join of function and fit
d_dict = dict(d)
f_dict = dict(fr.eval(start=tstart, end=tend, points=points))

for time in sorted(list(set(d_dict.keys() + f_dict.keys()))):
    res = lead_cols.get(time, padding) + [time, d_dict.get(time, NA), time,  f_dict.get(time, NA)]
    if options.label:
		return self.f

	def eval(self, start=None, end=None, points=None):
		if start is None or end is None or points is None:
			t = self.x
		else:
			t = list(numpy.linspace(start,end,points))
		return [p for p in self.f.evalPoints(t)]

#########################
if __name__ == '__main__':
	
	import doubleexp_function
	
	# simple demos
	pf = doubleexp_function.func(_A=30250, _alpha=690, _beta=30.5)
	pf.printPoints(0, .1)
	print pf

	p0 = [22000, 600, 10, .005]
	v = [	(0.0, 0.0),
		(0.0010101010101, 14722.0870054),
		(0.0020202020202, 21385.9328302),
		(0.0030303030303, 24171.3509832),
		(0.0040404040404, 25096.7012502),
		(0.0050505050505, 25136.414614),
		(0.0070707070707, 24196.4109866),
		(0.0090909090909, 22881.6344439),
		(0.0111111111111, 21544.8974262),
		(0.0121212121212, 20896.1721771),
		(0.0161616161616, 18477.4771294),