Index: trunk/doc/release.2015/ps1.analysis/psphot.design.tex
===================================================================
--- trunk/doc/release.2015/ps1.analysis/psphot.design.tex	(revision 39949)
+++ trunk/doc/release.2015/ps1.analysis/psphot.design.tex	(revision 39949)
@@ -0,0 +1,58 @@
+
+PSPhot uses a single structure to represent the source model and
+another structure to represent the PSF model.  The source model
+structure consists of the collection of measured source model
+parameters, carried as a \code{psLib} vector (\code{psVector}) along
+with an equal-length vector with the parameter errors.  The structure
+also includes an integer giving the identifier of the model used in
+the particular case, as well as model fit statistics such as the
+Chi-Square of the fit and the magnitude representation of the ratio
+between the model flux and an aperture flux (see below for more
+details on this value).
+
+The PSPhot representation of the PSF consists of an array of
+polynomials, each representing the variation in the source model PSF
+parameters (\code{psArray} of \code{psPolynomial2D}).  The PSF model
+structure also includes the same integer used to identify which model
+corresponds to particular instance of the PSF.  At the moment, the
+number of PSF parameters is a fixed number (4) fewer than the number
+of parameters of the corresponding source model.  For example, the
+elliptical Gaussian model uses 7 parameters to represent the source and
+3 for the PSF model.  
+
+PSPhot is written so that the source detection, measurement, and
+classification code does not depend on the specific form of the
+available source model functions.  Access to the characteristics of
+the models is provided through a simple function abstraction method.
+Throughout PSPhot, there are many places where it is necessary for the
+code to refer to an aspect of the source or PSF model.  Often, these
+quantities are needed deep within other parts of the code.  For
+example, when attempting to fit the pixel flux values for a source,
+it is necessary to generate a guess for the model parameters.  Or, in
+order to limit the domain of the fit, it is necessary to determine an
+isophotal radius for a model.  
+
+In order to avoid having the code depend on the specific form of a
+model, the function calls needed in these types of circumstances are
+abstracted, and a method is provided to return the necessary function
+to the higher-level software.  For example, each model type has its
+own function to define an initial guess for the model, or a function
+to determine the radius for a given flux level.  These are then
+registered as part of the model function code.  Another function is
+then used to return the appropriate function for a specific model
+type.  For example, the \code{psModelLookup_GetFunction} will return
+the \code{psModelLookup} function for a given model type.  This
+mechanism makes it very easy to add new model functions into the
+PSPhot code base.  To add a new model function, the programmer simply
+defines a new model name (a string), the set of all necessary model
+lookup functions, and places the reference to the model code at the
+appropriate location in the psModelInit.c routine.
+
+When a new model is provided to PSPhot, it is not necessary to specify
+the intended use of the source model function (ie, PSF-like source,
+galaxy, comet, etc).  Any model can be used for the PSF model, or to
+describe the flux distributions of the non-PSF sources.  The code
+currently uses a fixed translation between the source model parameters
+and the PSF model parameters.  It also defines a specific order for
+the 4 independent parameters.  
+
