To install:

1. If not already installed, download and install the following packages:

	a. The Gnu Scientific Library (gsl) - provides standard numerical 
		analysis packages in C. Should the build process for lsqfit
		have difficutly finding the gsl libraries or headers, modify the
		build script (setup.py) to point to the directories containing the 
		gsl headers and compiled libraries: add explicit addresses to the 
		include_dirs, library_dirs, and runtime_library_dirs lists in
		setup.py.
		(http://www.gnu.org/software/gsl/)
		
	b. The numpy python library - provides fast floating-point array 
		operations in python. Versions earlier than 1.6 may not work.
		(http://numpy.scipy.org/)

	c. The cython python package - provides a variant of python that 
		compiles into C code that can itself be compiled and is faster (but
        less flexible) than ordinary python. Versions earlier than 0.17
		may not work. 
		(http://www.cython.org/)

	d. The gvar python package - provides tools for creating and 
		manipulating Gaussian random variables, which are used for
		designing Bayesian priors, report fit results, etc, etc. This
		package will be installed automatically when lsqfit is installed
		provided setuptools are available (see next entry). gvar 
		is available on PyPI and so can also be installed 
		using 'pip install gvar'. If setuptools fails to install gvar
		(eg, something goes wrong), install it yourself (eg, pip install gvar).
		(https://github.com/gplepage/gvar or on PyPI)

	e. The setuptools package (optional). setuptools is used in place of
		distutils for installing the package, if setuptools is present. 
		setuptools automatically ensures that modules needed by gvar 
		are installed and sufficiently up-to-date. If setuptools is not 
		installed, distutils is used and dependencies are not checked --- 
		this must then be done by hand. To install setuptools either:
		1) download https://bootstrap.pypa.io/ez_setup.py
  		and run 'python ez_setup.py'; or 2) go to the setuptools website 
  		for instructions.
  		(https://pythonhosted.org/setuptools/)

				
	The lsqfit code works for Python 2.6 and 2.7, and Python 3.2-3.4. It
	does not work for Python versions 2.5.X or earlier. It has not been tested
	for Python 3.0 and 3.1, but likely works at least with the latter. Some
	of the tests don't work with Python 2.6.

2. Use 'make install'. This will build the lsqfit package, and 
	then copy it into a standard directory in the user's space that
	Python knows about. A list of the installed files is stored in file
	files-lsqfit.python (in case, for example, you want to uninstall them).
	
	N.B. Rather than using make and the makefile, one can instead use 
	standard distutils commands: eg, 'python setup.py install --user'
	
	N.B. If you have previously installed older versions of lsqfit,
	consider removing the earlier modules to make sure that the new ones are 
	used by Python. This will not be a problem if the new modules overwrite
	the older ones, but could cause trouble if the new modules are written 
	to a different place. Find out where the older modules are stored by
	using 'pydoc lsqfit' before installing the new software
	(pydoc lists the location of the module under "FILE").
	
	N.B. To install lsqfit for an alternative version of python, say python3 
	for example, use 'make PYTHON=python3 install'. Python's standard 
	directories are structured in such a way that it is necessary to do 
	a separate installation for each python version that will be used for 
	lsqfit.
		
	N.B. Adjust the entries for variables include_dirs, library_dirs, and
	runtime_library_dirs in setup.py if 'make install' generates complaints about
	being unable to find header files for gsl or numpy, or libraries for gsl.
	These variables are lists of directories that the build code looks in for 
	include files and libraries, in addition to the standard places built 
	into the system.
	
3. (Optional) Run 'make tests' to test your installation of lsqfit if you
	are using Python 2.7 or later (they don't work as well with Python 2.6). 
	The tests have been successful if the output ends with "OK". 
	Some tests involve random numbers and so may occasionally --- less than 
	1 in 100 runs --- fail due to rare multi-sigma fluctuations; rerun the 
	tests if they do fail. Contact g.p.lepage@cornell.edu if there are 
	persistent, frequent failures.
	
	N.B. The tests can also be run directly using Python's unittest module:
	"python -m unittest discover".
	
4. (Optional) Change to subdirectory examples/ and look at some of the 
 	sample .py files given there that use lsqfit. Run them one by one --- 
	"python simple.py" etc --- or all at once using "make run".
	
5. (Optional) Use 'make clean' to erase work files/directories.


To uninstall:

1. 'make uninstall' (probably) uninstalls most of what was installed. It 
    uses pip uninstall.


Problems:

	Contact Peter Lepage: g.p.lepage@cornell.edu


# Copyright (c) 2008-2015 G. Peter Lepage. 
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version (see <http://www.gnu.org/licenses/>).
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
