public software.sextractor

[/] [trunk/] [src/] [makeit.c] - Diff between revs 244 and 284

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 244 Rev 284
Line 20... Line 20...
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*       GNU General Public License for more details.
*       GNU General Public License for more details.
*       You should have received a copy of the GNU General Public License
*       You should have received a copy of the GNU General Public License
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*       along with SExtractor. If not, see <http://www.gnu.org/licenses/>.
*
*
*       Last modified:          22/04/2011
*       Last modified:          02/11/2011
*
*
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
 
 
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include        "config.h"
#include        "config.h"
Line 55... Line 55...
#include        "weight.h"
#include        "weight.h"
#include        "xml.h"
#include        "xml.h"
 
 
static int              selectext(char *filename);
static int              selectext(char *filename);
time_t                  thetimet, thetimet2;
time_t                  thetimet, thetimet2;
extern profitstruct     *theprofit,*thepprofit,*theqprofit;
extern profitstruct     *theprofit,*thedprofit, *thepprofit,*theqprofit;
extern char             profname[][32];
extern char             profname[][32];
double                  dtime;
double                  dtime;
 
 
/******************************** makeit *************************************/
/******************************** makeit *************************************/
/*
/*
Line 73... Line 73...
   catstruct            *imacat;
   catstruct            *imacat;
   tabstruct            *imatab;
   tabstruct            *imatab;
   patternstruct        *pattern;
   patternstruct        *pattern;
   static time_t        thetime1, thetime2;
   static time_t        thetime1, thetime2;
   struct tm            *tm;
   struct tm            *tm;
 
   unsigned int         modeltype;
   int                  nflag[MAXFLAG], nparam2[2],
   int                  nflag[MAXFLAG], nparam2[2],
                        i, nok, ntab, next, ntabmax, forcextflag,
                        i, nok, ntab, next, ntabmax, forcextflag,
                        nima0,nima1, nweight0,nweight1, npat;
                        nima0,nima1, nweight0,nweight1, npat;
 
 
/* Install error logging */
/* Install error logging */
Line 108... Line 109...
  useprefs();                   /* update things accor. to prefs parameters */
  useprefs();                   /* update things accor. to prefs parameters */
 
 
  if (prefs.psf_flag)
  if (prefs.psf_flag)
    {
    {
    NFPRINTF(OUTPUT, "Reading PSF information");
    NFPRINTF(OUTPUT, "Reading PSF information");
    thepsf = psf_load(prefs.psf_name[0]);
 
    if (prefs.dpsf_flag)
    if (prefs.dpsf_flag)
      ppsf = psf_load(prefs.psf_name[1]);
      {
 
      thedpsf = psf_load(prefs.psf_name[0]);
 
      thepsf = psf_load(prefs.psf_name[1]);
 
      }
 
    else
 
      thepsf = psf_load(prefs.psf_name[0]);
 /*-- Need to check things up because of PSF context parameters */
 /*-- Need to check things up because of PSF context parameters */
    updateparamflags();
    updateparamflags();
    useprefs();
    useprefs();
    }
    }
 
 
Line 122... Line 127...
    {
    {
#ifdef USE_MODEL
#ifdef USE_MODEL
    fft_init(prefs.nthreads);
    fft_init(prefs.nthreads);
/* Create profiles at full resolution */
/* Create profiles at full resolution */
    NFPRINTF(OUTPUT, "Preparing profile models");
    NFPRINTF(OUTPUT, "Preparing profile models");
    theprofit = profit_init(thepsf,
    modeltype = (FLAG(obj2.prof_offset_flux)? MODEL_BACK : MODEL_NONE)
         (FLAG(obj2.prof_offset_flux)? MODEL_BACK : MODEL_NONE)
 
        |(FLAG(obj2.prof_dirac_flux)? MODEL_DIRAC : MODEL_NONE)
        |(FLAG(obj2.prof_dirac_flux)? MODEL_DIRAC : MODEL_NONE)
        |(FLAG(obj2.prof_spheroid_flux)?
        |(FLAG(obj2.prof_spheroid_flux)?
                (FLAG(obj2.prof_spheroid_sersicn)?
                (FLAG(obj2.prof_spheroid_sersicn)?
                        MODEL_SERSIC : MODEL_DEVAUCOULEURS) : MODEL_NONE)
                        MODEL_SERSIC : MODEL_DEVAUCOULEURS) : MODEL_NONE)
        |(FLAG(obj2.prof_disk_flux)? MODEL_EXPONENTIAL : MODEL_NONE)
        |(FLAG(obj2.prof_disk_flux)? MODEL_EXPONENTIAL : MODEL_NONE)
        |(FLAG(obj2.prof_bar_flux)? MODEL_BAR : MODEL_NONE)
        |(FLAG(obj2.prof_bar_flux)? MODEL_BAR : MODEL_NONE)
        |(FLAG(obj2.prof_arms_flux)? MODEL_ARMS : MODEL_NONE));
        |(FLAG(obj2.prof_arms_flux)? MODEL_ARMS : MODEL_NONE);
 
    theprofit = profit_init(thepsf, modeltype);
    changecatparamarrays("VECTOR_MODEL", &theprofit->nparam, 1);
    changecatparamarrays("VECTOR_MODEL", &theprofit->nparam, 1);
    changecatparamarrays("VECTOR_MODELERR", &theprofit->nparam, 1);
    changecatparamarrays("VECTOR_MODELERR", &theprofit->nparam, 1);
    nparam2[0] = nparam2[1] = theprofit->nparam;
    nparam2[0] = nparam2[1] = theprofit->nparam;
    changecatparamarrays("MATRIX_MODELERR", nparam2, 2);
    changecatparamarrays("MATRIX_MODELERR", nparam2, 2);
 
    if (prefs.dprof_flag)
 
      thedprofit = profit_init(thedpsf, modeltype);
    if (prefs.pattern_flag)
    if (prefs.pattern_flag)
      {
      {
      npat = prefs.prof_disk_patternvectorsize;
      npat = prefs.prof_disk_patternvectorsize;
      if (npat<prefs.prof_disk_patternmodvectorsize)
      if (npat<prefs.prof_disk_patternmodvectorsize)
        npat = prefs.prof_disk_patternmodvectorsize;
        npat = prefs.prof_disk_patternmodvectorsize;
Line 443... Line 450...
 
 
/*-- Initialize PSF contexts and workspace */
/*-- Initialize PSF contexts and workspace */
    if (prefs.psf_flag)
    if (prefs.psf_flag)
      {
      {
      psf_readcontext(thepsf, field);
      psf_readcontext(thepsf, field);
      psf_init(thepsf);
      psf_init();
      if (prefs.dpsf_flag)
      if (prefs.dpsf_flag)
        {
        {
        psf_readcontext(thepsf, dfield);
        psf_readcontext(thepsf, dfield);
        psf_init(thepsf); /*?*/
        psf_init();
        }
        }
      }
      }
 
 
/*-- Copy field structures to static ones (for catalog info) */
/*-- Copy field structures to static ones (for catalog info) */
    if (dfield)
    if (dfield)
Line 544... Line 551...
 
 
#ifdef USE_MODEL
#ifdef USE_MODEL
  if (prefs.prof_flag)
  if (prefs.prof_flag)
    {
    {
    profit_end(theprofit);
    profit_end(theprofit);
 
    if (prefs.dprof_flag)
 
      profit_end(thedprofit);
    if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration))
    if (FLAG(obj2.prof_concentration)|FLAG(obj2.prof_concentration))
      {
      {
      profit_end(thepprofit);
      profit_end(thepprofit);
      profit_end(theqprofit);
      profit_end(theqprofit);
      }
      }
    fft_end();
    fft_end();
    }
    }
#endif
#endif
 
 
  if (prefs.psf_flag)
  if (prefs.psf_flag)
    psf_end(thepsf,thepsfit); /*?*/
    psf_end(thepsf, thepsfit);
 
 
  if (prefs.dpsf_flag)
  if (prefs.dpsf_flag)
    psf_end(ppsf,ppsfit);
    psf_end(thedpsf, thedpsfit);
 
 
  if (FLAG(obj2.sprob))
  if (FLAG(obj2.sprob))
    neurclose();
    neurclose();
 
 
/* Processing end date and time */
/* Processing end date and time */