/* @file  pmSourceExtendedPars.h
 *
 * @author EAM, IfA
 *
 * @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
 * @date $Date: 2009-02-06 02:31:25 $
 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii
 */

# ifndef PM_SOURCE_EXTENDED_PARS_H
# define PM_SOURCE_EXTENDED_PARS_H

/// @addtogroup Objects Object Detection / Analysis Functions
/// @{

typedef struct {
    psArray  *radii;			// radii for raw radial profiles at evenly-spaced angles
    psArray  *fluxes;			// fluxes measured at above radii
    psVector *theta;			// angles corresponding to above radial profiles
    psVector *isophotalRadii;		// isophotal radius for the above angles

    psVector *radiusElliptical;		// normalized radial coordinates for all relevant pixels
    psVector *fluxElliptical;		// flux for the above radial coordinates

    psVector *binSB;			// mean surface brightness within radial bins
    psVector *binSBstdev;		// scatter of mean surface brightness within radial bins
    psVector *binSBerror;		// formal error on mean surface brightness within radial bins

    psVector *radialBins;		// radii corresponding to above binnedBlux
    psVector *area;			// differential area of the non-overlapping radial bins

    psEllipseAxes axes;			// shape of elliptical contour
} pmSourceRadialProfile;

typedef struct {
  float flux;
  float fluxErr;
  float radius;
  float radiusErr;
} pmSourceExtendedFlux;

typedef struct {
  pmSourceRadialProfile   *profile;
  pmSourceExtendedFlux    *petrosian_50;
  pmSourceExtendedFlux    *petrosian_80;
} pmSourceExtendedPars;

// *** pmSourceRadialProfile describes the radial profile of a source in elliptical contours, and 
// intermediate data used to measure the profile
pmSourceRadialProfile *pmSourceRadialProfileAlloc();
bool psMemCheckSourceRadialProfile(psPtr ptr);

// *** pmSourceRadialProfileFreeVectors frees the intermediate data values
bool pmSourceRadialProfileFreeVectors(pmSourceRadialProfile *profile);

// *** pmSourceExtendedPars describes the possible collection of extended flux measurements for a source
pmSourceExtendedPars *pmSourceExtendedParsAlloc (void);
bool psMemCheckSourceExtendedPars(psPtr ptr);

// *** pmSourceExtendedFlux describes the flux within an elliptical aperture of some kind 
pmSourceExtendedFlux *pmSourceExtendedFluxAlloc(void);
bool psMemCheckSourceExtendedFlux(psPtr ptr);

// *** pmSourceRadialProfileSortPair is a utility function for sorting a pair of vectors
bool pmSourceRadialProfileSortPair(psVector *index, psVector *extra);

/// @}
# endif /* PM_SOURCE_H */
