##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Lance Simms, Stanford University 2009
#Examples of using the functions in Gaussian.py: Copied from 
#http://www.scipty.org/Cookbook/FittingData
#
#NOTE: ** is the squaring operator
#    : ^ does something extremely interesting.  It looks like it's 
#	 swapping indices according to the argument.
import sys,os
import pyfits
from numpy import *
from pylab import *

#Import the functions from Gaussian.py
import Gaussian
#Generate the gaussian
data = Gaussian.gaussian1d(200,100,2)(arange(200))
#Fit the Gaussian
fit, height, mean, width  = Gaussian.gaussian1dfit(data)
#Draw them
print 'Amplitude: ' +str(height)
print 'Mean     : ' +str(mean)
print 'FWHM     : ' +str(width)
matplotlib.pylab.plot(data)
matplotlib.pylab.plot(fit, 'r')
