IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 5, 2009, 11:24:29 AM (17 years ago)
Author:
beaumont
Message:

sync with mainline

Location:
branches/cnb_branches/cnb_branch_20090215
Files:
1 deleted
22 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/cnb_branches/cnb_branch_20090215

  • branches/cnb_branches/cnb_branch_20090215/psModules/src/camera/pmFPAWrite.c

    r23197 r23199  
    692692                     "Centre of covariance matrix in y", -yMinCovar);
    693693
     694    // Turn off compression
     695    int bitpix = fits->options ? fits->options->bitpix : 0; // Desired bits per pixel
     696    psFitsCompression *compress = psFitsCompressionGet(fits); // Current compression options
     697    if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) {
     698        psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE");
     699        psFree(extname);
     700        psFree(header);
     701        psFree(images);
     702        psFree(compress);
     703        return false;
     704    }
     705    if (fits->options) {
     706        fits->options->bitpix = 0;
     707    }
     708
    694709    // Write images
    695710    if (!psFitsWriteImageCube(fits, header, images, extname)) {
     
    699714        psFree(header);
    700715        psFree(images);
     716        if (fits->options) {
     717            fits->options->bitpix = bitpix;
     718        }
     719        psFitsCompressionApply(fits, compress);
     720        psFree(compress);
    701721        return 0;
    702722    }
     
    704724    psFree(header);
    705725    psFree(images);
     726
     727    // Restore compression
     728    if (fits->options) {
     729        fits->options->bitpix = bitpix;
     730    }
     731    if (!psFitsCompressionApply(fits, compress)) {
     732        psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE");
     733        psFree(compress);
     734        return false;
     735    }
     736    psFree(compress);
    706737
    707738    return true;
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/config/Makefile.am

    r18905 r23199  
    11noinst_LTLIBRARIES = libpsmodulesconfig.la
    22
    3 libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS)
     3PSMODULES_VERSION=`if [ -e ../../VERSION ]; then cat ../../VERSION; else svnversion; fi`
     4PSMODULES_BRANCH=`if [ -e ../../BRANCH ]; then cat ../../BRANCH; else svn info | sed -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'; fi`
     5PSMODULES_SOURCE=`if [ -e ../../SOURCE ]; then cat ../../SOURCE; else svn info | sed -n -e 's/Repository UUID: // p'; fi`
     6
     7# Force recompilation of pmVersion.c, since it gets the version information
     8pmVersion.c: FORCE
     9        touch pmVersion.c
     10FORCE: ;
     11
     12libpsmodulesconfig_la_CPPFLAGS = $(SRCINC) $(PSMODULES_CFLAGS) -DPSMODULES_VERSION=\"$(PSMODULES_VERSION)\" -DPSMODULES_BRANCH=\"$(PSMODULES_BRANCH)\" -DPSMODULES_SOURCE=\"$(PSMODULES_SOURCE)\"
    413libpsmodulesconfig_la_LDFLAGS  = -release $(PACKAGE_VERSION)
    514libpsmodulesconfig_la_SOURCES  = \
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.c

    r10291 r23199  
    88#include "pmVersion.h"
    99
    10 static const char *cvsTag = "$Name: not supported by cvs2svn $";// CVS tag name
    11 
    1210psString psModulesVersion(void)
    1311{
    14     psString version = NULL;            // Version, to return
    15     psStringAppend(&version, "%s-%s",PACKAGE_NAME,PACKAGE_VERSION);
    16     return version;
     12#ifndef PSMODULES_VERSION
     13#error "PSMODULES_VERSION is not set"
     14#endif
     15#ifndef PSMODULES_BRANCH
     16#error "PSMODULES_BRANCH is not set"
     17#endif
     18    return psStringCopy(PSMODULES_BRANCH "@" PSMODULES_VERSION);
    1719}
     20
     21psString psModulesSource(void)
     22{
     23#ifndef PSMODULES_SOURCE
     24#error "PSMODULES_SOURCE is not set"
     25#endif
     26    return psStringCopy(PSMODULES_SOURCE);
     27}
     28
    1829
    1930psString psModulesVersionLong(void)
    2031{
    21     psString version = psModulesVersion(); // Version, to return
    22     psString tag = psStringStripCVS(cvsTag, "Name"); // CVS tag
     32    psString version = psModulesVersion();  // Version, to return
     33    psString source = psModulesSource();    // Source
    2334
    24     psStringAppend(&version, " (cvs tag %s) %s, %s", tag, __DATE__, __TIME__);
     35    psStringPrepend(&version, "psModules ");
     36    psStringAppend(&version, " from %s, built %s, %s", source, __DATE__, __TIME__);
     37    psFree(source);
    2538
    26     psFree(tag);
     39#ifdef __OPTIMIZE__
     40    psStringAppend(&version, " optimised");
     41#else
     42    psStringAppend(&version, " unoptimised");
     43#endif
     44
     45#ifdef HAVE_NEBCLIENT
     46    psStringAppend(&version, " with nebclient");
     47#else
     48    psStringAppend(&version, " without nebclient");
     49#endif
     50
    2751    return version;
     52};
     53
     54
     55bool psModulesVersionHeader(psMetadata *header)
     56{
     57    PS_ASSERT_METADATA_NON_NULL(header, false);
     58
     59    psString version = psModulesVersion(); // Software version
     60    psString source = psModulesSource();   // Software source
     61
     62    psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.VERSION", PS_META_REPLACE,
     63                     "Software version", version);
     64    psMetadataAddStr(header, PS_LIST_TAIL, "IPP.PSMODULES.SOURCE", PS_META_REPLACE,
     65                     "S/W source", source);
     66
     67    psFree(version);
     68    psFree(source);
     69
     70    return true;
    2871}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/config/pmVersion.h

    r12696 r23199  
    11/*  @file pmVersion.h
    22 *  @brief Version functions
    3  * 
     3 *
    44 *  @author Paul Price, IfA
    55 *  @author Eugene Magnier, IfA
    6  * 
     6 *
    77 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    88 *  @date $Date: 2007-03-30 21:12:56 $
     
    2222 *  @return psString: String with version name.
    2323 */
    24 psString psModulesVersion(
    25     void
    26 );
     24psString psModulesVersion(void);
     25
     26/** Get current psModules source
     27 *
     28 *  Returns the current psModules source as a string.
     29 *
     30 *  @return psString: String with source.
     31 */
     32psString psModulesSource(void);
    2733
    2834/** Get current psModules version (full identification)
     
    3440psString psModulesVersionLong(void);
    3541
     42/// Populate a header with version information
     43bool psModulesVersionHeader(
     44    psMetadata *header                  ///< Header to populate
     45    );
     46
     47
    3648/// @}
    3749#endif
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/imcombine/pmPSFEnvelope.c

    r22722 r23199  
    115115    for (int i = 0; i < inputs->n; i++) {
    116116        pmPSF *psf = inputs->data[i];   // PSF of interest
     117        if (!psf) {
     118            continue;
     119        }
    117120        pmResiduals *resid = psf->residuals;// PSF residuals
    118121        psf->residuals = NULL;
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/Makefile.am

    r21536 r23199  
    1919        pmModelUtils.c \
    2020        pmSource.c \
     21        pmSourceMasks.c \
    2122        pmSourceMoments.c \
    2223        pmSourceExtendedPars.c \
     
    6970        pmModelUtils.h \
    7071        pmSource.h \
     72        pmSourceMasks.h \
    7173        pmSourceExtendedPars.h \
    7274        pmSourceUtils.h \
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmFootprint.c

    r20937 r23199  
    2828   }
    2929
    30    psTrace("psModules.objects", 5, "---- begin ----\n");
     30   psTrace("psModules.objects", 10, "---- begin ----\n");
    3131
    3232   psFree(tmp->spans);
    3333   psFree(tmp->peaks);
    3434
    35    psTrace("psModules.objects", 5, "---- end ----\n");
     35   psTrace("psModules.objects", 10, "---- end ----\n");
    3636}
    3737
     
    4242                              const psImage *image) // region footprint lives in
    4343{
    44     psTrace("psModules.objects", 5, "---- begin ----\n");
     44    psTrace("psModules.objects", 10, "---- begin ----\n");
    4545
    4646    static int id = 1;
     
    6969    }
    7070
    71     psTrace("psModules.objects", 5, "---- end ----\n");
     71    psTrace("psModules.objects", 10, "---- end ----\n");
    7272    return(footprint);
    7373}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmModel.c

    r23197 r23199  
    3232static void modelFree(pmModel *tmp)
    3333{
    34     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     34    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    3535    psFree(tmp->params);
    3636    psFree(tmp->dparams);
    37     psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     37    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    3838}
    3939
     
    4444pmModel *pmModelAlloc(pmModelType type)
    4545{
    46     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     46    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    4747
    4848    pmModelClass *class = pmModelClassSelect (type);
     
    8787    tmp->modelFitStatus     = class->modelFitStatus;
    8888
    89     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     89    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    9090    return(tmp);
    9191}
     
    130130psF32 pmModelEval(pmModel *model, psImage *image, psS32 col, psS32 row)
    131131{
    132     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     132    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    133133    PS_ASSERT_PTR_NON_NULL(image, NAN);
    134134    PS_ASSERT_PTR_NON_NULL(model, NAN);
     
    144144    tmpF = model->modelFunc (NULL, model->params, x);
    145145    psFree(x);
    146     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     146    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    147147    return(tmpF);
    148148}
     
    150150psF32 pmModelEvalWithOffset(pmModel *model, psImage *image, psS32 col, psS32 row, int dx, int dy)
    151151{
    152     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     152    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    153153    PS_ASSERT_PTR_NON_NULL(image, false);
    154154    PS_ASSERT_PTR_NON_NULL(model, false);
     
    164164    tmpF = model->modelFunc (NULL, model->params, x);
    165165    psFree(x);
    166     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     166    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    167167    return(tmpF);
    168168}
     
    180180    )
    181181{
    182     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     182    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    183183
    184184    PS_ASSERT_PTR_NON_NULL(model, false);
     
    344344
    345345    psFree(x);
    346     psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);
     346    psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__);
    347347    return(true);
    348348}
     
    356356                psImageMaskType maskVal)
    357357{
    358     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     358    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    359359    psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, 0.0, 0.0);
    360     psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);
     360    psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc);
    361361    return(rc);
    362362}
     
    370370                psImageMaskType maskVal)
    371371{
    372     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     372    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    373373    psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, 0.0, 0.0);
    374     psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);
     374    psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc);
    375375    return(rc);
    376376}
     
    386386                          int dy)
    387387{
    388     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     388    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    389389    psBool rc = AddOrSubModel(image, mask, model, mode, true, maskVal, dx, dy);
    390     psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);
     390    psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc);
    391391    return(rc);
    392392}
     
    402402                          int dy)
    403403{
    404     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     404    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    405405    psBool rc = AddOrSubModel(image, mask, model, mode, false, maskVal, dx, dy);
    406     psTrace("psModules.objects", 3, "---- %s(%d) end ----\n", __func__, rc);
     406    psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc);
    407407    return(rc);
    408408}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmMoments.c

    r19879 r23199  
    2727pmMoments *pmMomentsAlloc()
    2828{
    29     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     29    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    3030    pmMoments *tmp = (pmMoments *) psAlloc(sizeof(pmMoments));
    3131    tmp->Mx = 0.0;
     
    5252    tmp->nPixels = 0;
    5353
    54     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     54    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    5555    return(tmp);
    5656}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmPeaks.c

    r23197 r23199  
    3737                        pmPeakType type)
    3838{
    39     psTrace("psModules.objects", 5, "---- begin ----\n");
     39    psTrace("psModules.objects", 10, "---- begin ----\n");
    4040
    4141    if (peaks == NULL) {
     
    8282    psFree (peak);
    8383
    84     psTrace("psModules.objects", 5, "---- end ----\n");
     84    psTrace("psModules.objects", 10, "---- end ----\n");
    8585    return(peaks);
    8686}
     
    9696                                       psU32 row)
    9797{
    98     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     98    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    9999    PS_ASSERT_IMAGE_NON_NULL(image, NULL);
    100100    PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL);
     
    104104        tmpVector->data.F32[col] = image->data.F32[row][col];
    105105    }
    106     psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     106    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    107107    return(tmpVector);
    108108}
     
    117117                             psS32 y)
    118118{
    119     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     119    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    120120    if ((x >= valid.x0) &&
    121121            (x <= valid.x1) &&
    122122            (y >= valid.y0) &&
    123123            (y <= valid.y1)) {
    124         psTrace("psModules.objects", 4, "---- %s(true) end ----\n", __func__);
     124        psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__);
    125125        return(true);
    126126    }
    127     psTrace("psModules.objects", 4, "---- %s(false) end ----\n", __func__);
     127    psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__);
    128128    return(false);
    129129}
     
    140140                    pmPeakType type)
    141141{
    142     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     142    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    143143    static int id = 1;
    144144    pmPeak *tmp = (pmPeak *) psAlloc(sizeof(pmPeak));
     
    157157    psMemSetDeallocator(tmp, (psFreeFunc) peakFree);
    158158
    159     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     159    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    160160    return(tmp);
    161161}
     
    172172int pmPeaksCompareAscend (const void **a, const void **b)
    173173{
    174     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     174    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    175175    pmPeak *A = *(pmPeak **)a;
    176176    pmPeak *B = *(pmPeak **)b;
     
    180180    diff = A->value - B->value;
    181181    if (diff < FLT_EPSILON) {
    182         psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);
     182        psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__);
    183183        return (-1);
    184184    } else if (diff > FLT_EPSILON) {
    185         psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);
     185        psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__);
    186186        return (+1);
    187187    }
    188     psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);
     188    psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__);
    189189    return (0);
    190190}
     
    194194int pmPeaksCompareDescend (const void **a, const void **b)
    195195{
    196     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     196    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    197197    pmPeak *A = *(pmPeak **)a;
    198198    pmPeak *B = *(pmPeak **)b;
     
    202202    diff = A->value - B->value;
    203203    if (diff < FLT_EPSILON) {
    204         psTrace("psModules.objects", 3, "---- %s(+1) end ----\n", __func__);
     204        psTrace("psModules.objects", 10, "---- %s(+1) end ----\n", __func__);
    205205        return (+1);
    206206    } else if (diff > FLT_EPSILON) {
    207         psTrace("psModules.objects", 3, "---- %s(-1) end ----\n", __func__);
     207        psTrace("psModules.objects", 10, "---- %s(-1) end ----\n", __func__);
    208208        return (-1);
    209209    }
    210     psTrace("psModules.objects", 3, "---- %s(0) end ----\n", __func__);
     210    psTrace("psModules.objects", 10, "---- %s(0) end ----\n", __func__);
    211211    return (0);
    212212}
     
    258258                         psF32 threshold)
    259259{
    260     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     260    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    261261    PS_ASSERT_VECTOR_NON_NULL(vector, NULL);
    262262    PS_ASSERT_VECTOR_NON_EMPTY(vector, NULL);
     
    276276            tmpVector = psVectorAlloc(0, PS_TYPE_U32);
    277277        }
    278         psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     278        psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    279279        return(tmpVector);
    280280    }
     
    341341    }
    342342
    343     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     343    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    344344    return(tmpVector);
    345345}
     
    363363psArray *pmPeaksInImage(const psImage *image, psF32 threshold)
    364364{
    365     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     365    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    366366    PS_ASSERT_IMAGE_NON_NULL(image, NULL);
    367367    PS_ASSERT_IMAGE_TYPE(image, PS_TYPE_F32, NULL);
    368368    if ((image->numRows == 1) || (image->numCols == 1)) {
    369369        psError(PS_ERR_UNKNOWN, true, "Currently, input image must have at least 2 rows and 2 columns.");
    370         psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);
     370        psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__);
    371371        return(NULL);
    372372    }
     
    425425    //
    426426    if (image->numRows == 1) {
    427         psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     427        psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    428428        return(list);
    429429    }
     
    549549    psFree (tmpRow);
    550550    psFree (row1);
    551     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     551    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    552552    return(list);
    553553}
     
    560560    const psRegion valid)
    561561{
    562     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     562    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    563563    PS_ASSERT_PTR_NON_NULL(peaks, NULL);
    564564
     
    575575        psArrayAdd (output, 200, tmpPeak);
    576576    }
    577     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     577    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    578578    return(output);
    579579}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.c

    r23197 r23199  
    4141        return;
    4242
    43     psTrace("psModules.objects", 5, "---- begin ----\n");
     43    psTrace("psModules.objects", 10, "---- begin ----\n");
    4444    psFree(tmp->peak);
    4545    psFree(tmp->pixels);
     
    5555    psFree(tmp->extpars);
    5656    psFree(tmp->blends);
    57     psTrace("psModules.objects", 5, "---- end ----\n");
     57    psTrace("psModules.objects", 10, "---- end ----\n");
    5858}
    5959
     
    9494pmSource *pmSourceAlloc()
    9595{
    96     psTrace("psModules.objects", 5, "---- begin ----\n");
     96    psTrace("psModules.objects", 10, "---- begin ----\n");
    9797    static int id = 1;
    9898    pmSource *source = (pmSource *) psAlloc(sizeof(pmSource));
     
    131131    source->extNsigma = NAN;
    132132
    133     psTrace("psModules.objects", 5, "---- end ----\n");
     133    psTrace("psModules.objects", 10, "---- end ----\n");
    134134    return(source);
    135135}
     
    280280pmPSFClump pmSourcePSFClump(psRegion *region, psArray *sources, psMetadata *recipe)
    281281{
    282     psTrace("psModules.objects", 5, "---- begin ----\n");
     282    psTrace("psModules.objects", 10, "---- begin ----\n");
    283283
    284284    psArray *peaks  = NULL;
     
    496496    }
    497497
    498     psTrace("psModules.objects", 5, "---- end ----\n");
     498    psTrace("psModules.objects", 10, "---- end ----\n");
    499499    return (psfClump);
    500500}
     
    508508bool pmSourceRoughClass(psRegion *region, psArray *sources, psMetadata *recipe, pmPSFClump clump, psImageMaskType maskSat)
    509509{
    510     psTrace("psModules.objects", 5, "---- begin ----");
     510    psTrace("psModules.objects", 10, "---- begin ----");
    511511
    512512    PS_ASSERT_PTR_NON_NULL(sources, false);
     
    664664    psTrace ("psModules.objects", 2, "Ncr:      %3d\n", Ncr);
    665665
    666     psTrace("psModules.objects", 5, "---- end ----\n");
     666    psTrace("psModules.objects", 10, "---- end ----\n");
    667667    return true;
    668668}
     
    692692                     psF32 radius)
    693693{
    694     psTrace("psModules.objects", 5, "---- begin ----\n");
     694    psTrace("psModules.objects", 10, "---- begin ----\n");
    695695    PS_ASSERT_PTR_NON_NULL(source, false);
    696696    PS_ASSERT_PTR_NON_NULL(source->peak, false);
     
    807807        psTrace ("psModules.objects", 3, "insufficient valid pixels (%d vs %d; %f) for source\n",
    808808                 numPixels, (int)(0.75*R2), Sum);
    809         psTrace("psModules.objects", 5, "---- end (false) ----\n");
     809        psTrace("psModules.objects", 10, "---- end (false) ----\n");
    810810        return (false);
    811811    }
     
    824824        psTrace ("psModules.objects", 3, "large centroid swing; invalid peak %d, %d\n",
    825825                 source->peak->x, source->peak->y);
    826         psTrace("psModules.objects", 5, "---- end(false)  ----\n");
     826        psTrace("psModules.objects", 10, "---- end(false)  ----\n");
    827827        return (false);
    828828    }
     
    850850             source->moments->Mxx, source->moments->Myy, source->moments->Mxy);
    851851
    852     psTrace("psModules.objects", 5, "---- end ----\n");
     852    psTrace("psModules.objects", 10, "---- end ----\n");
    853853    return(true);
    854854}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSource.h

    r23197 r23199  
    1919/// @addtogroup Objects Object Detection / Analysis Functions
    2020/// @{
     21
     22#include <pmSourceMasks.h>
    2123
    2224/** pmSourceType enumeration
     
    3436    PM_SOURCE_TYPE_EXTENDED,            ///< an extended object (eg, galaxy) (subtracted model is EXT)
    3537} pmSourceType;
    36 
    37 // bit flags to distinguish analysis results
    38 typedef enum {
    39     PM_SOURCE_MODE_DEFAULT          = 0x00000000, ///< Initial value: resets all bits
    40     PM_SOURCE_MODE_PSFMODEL         = 0x00000001, ///< Source fitted with a psf model (linear or non-linear)
    41     PM_SOURCE_MODE_EXTMODEL         = 0x00000002, ///< Source fitted with an extended-source model
    42     PM_SOURCE_MODE_FITTED           = 0x00000004, ///< Source fitted with non-linear model (PSF or EXT; good or bad)
    43     PM_SOURCE_MODE_FAIL             = 0x00000008, ///< Fit (non-linear) failed (non-converge, off-edge, run to zero)
    44     PM_SOURCE_MODE_POOR             = 0x00000010, ///< Fit succeeds, but low-SN, high-Chisq, or large (for PSF -- drop?)
    45     PM_SOURCE_MODE_PAIR             = 0x00000020, ///< Source fitted with a double psf
    46     PM_SOURCE_MODE_PSFSTAR          = 0x00000040, ///< Source used to define PSF model
    47     PM_SOURCE_MODE_SATSTAR          = 0x00000080, ///< Source model peak is above saturation
    48     PM_SOURCE_MODE_BLEND            = 0x00000100, ///< Source is a blend with other sourcers
    49     PM_SOURCE_MODE_EXTERNAL         = 0x00000200, ///< Source based on supplied input position
    50     PM_SOURCE_MODE_BADPSF           = 0x00000400, ///< Failed to get good estimate of object's PSF
    51     PM_SOURCE_MODE_DEFECT           = 0x00000800, ///< Source is thought to be a defect
    52     PM_SOURCE_MODE_SATURATED        = 0x00001000, ///< Source is thought to be saturated pixels (bleed trail)
    53     PM_SOURCE_MODE_CR_LIMIT         = 0x00002000, ///< Source has crNsigma above limit
    54     PM_SOURCE_MODE_EXT_LIMIT        = 0x00004000, ///< Source has extNsigma above limit
    55     PM_SOURCE_MODE_MOMENTS_FAILURE  = 0x00008000, ///< could not measure the moments
    56     PM_SOURCE_MODE_SKY_FAILURE      = 0x00010000, ///< could not measure the local sky
    57     PM_SOURCE_MODE_SKYVAR_FAILURE   = 0x00020000, ///< could not measure the local sky variance
    58     PM_SOURCE_MODE_BELOW_MOMENTS_SN = 0x00040000, ///< moments not measured due to low S/N
    59     PM_SOURCE_MODE_BIG_RADIUS       = 0x00100000, ///< poor moments for small radius, try large radius
    60     PM_SOURCE_MODE_AP_MAGS          = 0x00200000, ///< source has an aperture magnitude
    61     PM_SOURCE_MODE_BLEND_FIT        = 0x00400000, ///< source was fitted as a blend
    62     PM_SOURCE_MODE_EXTENDED_FIT     = 0x00800000, ///< full extended fit was used
    63     PM_SOURCE_MODE_EXTENDED_STATS   = 0x01000000, ///< extended aperture stats calculated
    64     PM_SOURCE_MODE_LINEAR_FIT       = 0x02000000, ///< source fitted with the linear fit
    65     PM_SOURCE_MODE_NONLINEAR_FIT    = 0x04000000, ///< source fitted with the non-linear fit
    66     PM_SOURCE_MODE_RADIAL_FLUX      = 0x08000000, ///< radial flux measurements calculated
    67     PM_SOURCE_MODE_SIZE_SKIPPED     = 0x10000000, ///< size could not be determined
    68 } pmSourceMode;
    6938
    7039typedef enum {
     
    10170    pmSourceType type;                  ///< Best identification of object.
    10271    pmSourceMode mode;                  ///< analysis flags set for object.
    103     pmSourceTmpF tmpFlags;              ///< internal-only flags
     72    pmSourceTmpF tmpFlags;              ///< internal-only flags
    10473    psArray *blends;                    ///< collection of sources thought to be confused with object
    10574    float psfMag;                       ///< calculated from flux in modelPSF
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceContour.c

    r20937 r23199  
    5959{
    6060
    61     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     61    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    6262
    6363    // We define variables incr and lastColumn so that we can use the same loop
     
    8080        float value = image->data.F32[y][subCol];
    8181        if (value <= threshold) {
    82             psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     82            psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    8383            return (subCol);
    8484        }
    8585        subCol += incr;
    8686    }
    87     psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     87    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    8888    return (lastColumn);
    8989}
     
    9999{
    100100
    101     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     101    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    102102
    103103    // We define variables incr and lastColumn so that we can use the same loop
     
    119119        float value = image->data.F32[y][subCol];
    120120        if (value >= threshold) {
    121             psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     121            psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    122122            if (subCol == x) {
    123123                return (subCol);
     
    127127        subCol += incr;
    128128    }
    129     psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     129    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    130130    return (lastColumn);
    131131}
     
    149149                       psU32 dir)
    150150{
    151     psTrace("psModules.objects", 4, "---- %s() begin ----\n", __func__);
     151    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    152152    //
    153153    // Convert coords to subImage space.
     
    159159    if (!((0 <= subCol) && (subCol < source->pixels->numCols))) {
    160160        psError(PS_ERR_UNKNOWN, true, "Starting column outside subImage range");
    161         psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);
     161        psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__);
    162162        return(NAN);
    163163    }
    164164    if (!((0 <= subRow) && (subRow < source->pixels->numRows))) {
    165         psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);
     165        psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__);
    166166        psError(PS_ERR_UNKNOWN, true, "Starting row outside subImage range");
    167167        return(NAN);
     
    172172    psF32 oldValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow);
    173173    if (oldValue == level) {
    174         psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     174        psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    175175        return(((psF32) (subCol + source->pixels->col0)));
    176176    }
     
    194194        psF32 newValue = pmModelEval(source->modelEXT, source->pixels, subCol, subRow);
    195195        if (oldValue == level) {
    196             psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     196            psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    197197            return((psF32) (subCol + source->pixels->col0));
    198198        }
     
    200200        if ((newValue <= level) && (level <= oldValue)) {
    201201            // This is simple linear interpolation.
    202             psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     202            psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    203203            return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - newValue) / (oldValue - newValue)) );
    204204        }
     
    206206        if ((oldValue <= level) && (level <= newValue)) {
    207207            // This is simple linear interpolation.
    208             psTrace("psModules.objects", 4, "---- %s() end ----\n", __func__);
     208            psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    209209            return( ((psF32) (subCol + source->pixels->col0)) + ((psF32) incr) * ((level - oldValue) / (newValue - oldValue)) );
    210210        }
     
    213213    }
    214214
    215     psTrace("psModules.objects", 4, "---- %s(NAN) end ----\n", __func__);
     215    psTrace("psModules.objects", 10, "---- %s(NAN) end ----\n", __func__);
    216216    return(NAN);
    217217}
     
    222222psArray *pmSourceContour (psImage *image, int xc, int yc, float threshold)
    223223{
    224     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     224    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    225225    PS_ASSERT_PTR_NON_NULL(image, NULL);
    226226
     
    339339    tmpArray->data[0] = (psPtr *) xVec;
    340340    tmpArray->data[1] = (psPtr *) yVec;
    341     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     341    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    342342    return(tmpArray);
    343343}
     
    360360                               psF32 level)
    361361{
    362     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     362    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    363363    PS_ASSERT_PTR_NON_NULL(source, false);
    364364    PS_ASSERT_PTR_NON_NULL(image, false);
     
    390390            psFree(xVec);
    391391            psFree(yVec);
    392             psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);
     392            psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__);
    393393            return(NULL);
    394394            //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n");
     
    403403            psFree(xVec);
    404404            psFree(yVec);
    405             psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);
     405            psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__);
    406406            return(NULL);
    407407            //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n");
     
    428428            psFree(xVec);
    429429            psFree(yVec);
    430             psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);
     430            psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__);
    431431            return(NULL);
    432432            //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n");
     
    440440            psFree(xVec);
    441441            psFree(yVec);
    442             psTrace("psModules.objects", 3, "---- %s(NULL) end ----\n", __func__);
     442            psTrace("psModules.objects", 10, "---- %s(NULL) end ----\n", __func__);
    443443            return(NULL);
    444444            //psLogMsg(__func__, PS_LOG_WARN, "WARNING: Could not find contour edge (NAN)\n");
     
    457457    tmpArray->data[0] = (psPtr *) yVec;
    458458    tmpArray->data[1] = (psPtr *) xVec;
    459     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     459    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    460460    return(tmpArray);
    461461}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitModel.c

    r23197 r23199  
    5858                       psImageMaskType maskVal)
    5959{
    60     psTrace("psModules.objects", 5, "---- %s begin ----\n", __func__);
     60    psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__);
    6161    PS_ASSERT_PTR_NON_NULL(source, false);
    6262    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
     
    231231
    232232    rc = (onPic && fitStatus);
    233     psTrace("psModules.objects", 5, "---- %s(%d) end ----\n", __func__, rc);
     233    psTrace("psModules.objects", 10, "---- %s(%d) end ----\n", __func__, rc);
    234234    return(rc);
    235235}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceFitSet.c

    r21363 r23199  
    446446                     psImageMaskType maskVal)
    447447{
    448     psTrace("psModules.objects", 3, "---- %s begin ----\n", __func__);
     448    psTrace("psModules.objects", 10, "---- %s begin ----\n", __func__);
    449449    PS_ASSERT_PTR_NON_NULL(source, false);
    450450    PS_ASSERT_PTR_NON_NULL(source->pixels, false);
     
    533533    if (nPix <  thisSet->nParamSet + 1) {
    534534        psTrace (__func__, 4, "insufficient valid pixels\n");
    535         psTrace("psModules.objects", 3, "---- %s() end : fail pixels ----\n", __func__);
     535        psTrace("psModules.objects", 10, "---- %s() end : fail pixels ----\n", __func__);
    536536        for (int i = 0; i < modelSet->n; i++) {
    537537            pmModel *model = modelSet->data[i];
     
    602602
    603603    bool rc = (onPic && fitStatus);
    604     psTrace("psModules.objects", 5, "---- %s end (%d) ----\n", __func__, rc);
     604    psTrace("psModules.objects", 10, "---- %s end (%d) ----\n", __func__, rc);
    605605    return(rc);
    606606}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceIO_CMF_PS1_V1.c

    r23197 r23199  
    209209    }
    210210
     211    psMetadata *header = psMetadataCopy(NULL, tableHeader);
     212    pmSourceMasksHeader(header);
     213
    211214    if (table->n == 0) {
    212         psFitsWriteBlank (fits, tableHeader, extname);
    213         psFree (table);
     215        psFitsWriteBlank(fits, header, extname);
     216        psFree(table);
     217        psFree(header);
    214218        return true;
    215219    }
    216220
    217221    psTrace ("pmFPAfile", 5, "writing ext data %s\n", extname);
    218     if (!psFitsWriteTable (fits, tableHeader, table, extname)) {
     222    if (!psFitsWriteTable(fits, header, table, extname)) {
    219223        psError(PS_ERR_IO, false, "writing ext data %s\n", extname);
    220224        psFree(table);
     225        psFree(header);
    221226        return false;
    222227    }
    223     psFree (table);
     228    psFree(table);
     229    psFree(header);
    224230
    225231    return true;
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceMatch.c

    r21266 r23199  
    6363        pmSource *source = sources->data[i]; // Source of interest
    6464        if (!source) continue;
    65         if (source->mode & SOURCE_MASK) continue;
    66         if (!isfinite(source->psfMag)) continue;
    67         if (!isfinite(source->errMag)) continue;
    68         if (source->psfMag > SOURCE_FAINTEST) continue;
     65        if (source->mode & SOURCE_MASK) continue;
     66        if (!isfinite(source->psfMag)) continue;
     67        if (!isfinite(source->errMag)) continue;
     68        if (source->psfMag > SOURCE_FAINTEST) continue;
    6969
    7070        float xSrc, ySrc;               // Coordinates of source
     
    290290static float sourceMatchRelphotIterate(psVector *trans, // Transparencies
    291291                                       psVector *stars, // Star magnitudes
     292                                       psVector *badImage, // Bad image mask
    292293                                       const psArray *matches, // Array of matches
    293294                                       const psVector *zp, // Zero points for each image (incl. airmass term)
     
    363364    for (int i = 0; i < numImages; i++) {
    364365        trans->data.F32[i] = accum->data.F64[i] / accumErr->data.F64[i];
    365 
     366        if (!isfinite(trans->data.F32[i])) {
     367            badImage->data.U8[i] = 0xFF;
     368        }
    366369        psTrace("psModules.objects", 3, "Transparency for image %d: %f\n", i, trans->data.F32[i]);
    367370    }
     
    379382            }
    380383            int index = match->image->data.U32[j]; // Image index
     384            if (badImage->data.U8[index]) {
     385                continue;
     386            }
    381387            float mag = match->mag->data.F32[j]; // Measured magnitude
    382388            float magErr2 = PS_SQR(match->magErr->data.F32[j]) + sysErr2; // Error in measured magnitude
     
    402408static int sourceMatchRelphotPhotometric(psVector *photo, // Photometric determination
    403409                                         const psVector *trans, // Estimated transparencies
     410                                         const psVector *badImage, // Bad image?
    404411                                         int transIter, // Iterations for transparency
    405412                                         float transClip, // Clipping level for transparency
     
    409416    psAssert(photo && photo->type.type == PS_TYPE_U8, "Need photometric determination");
    410417    psAssert(trans && trans->type.type == PS_TYPE_F32, "Need transparencies");
     418    psAssert(badImage && badImage->type.type == PS_TYPE_U8, "Need bad image determination");
    411419
    412420    int numImages = photo->n;              // Number of images
    413421
    414422    psAssert(trans->n == numImages, "Not enough transparencies: %ld", trans->n);
     423    psAssert(badImage->n == numImages, "Not enough bad image determinations: %ld", badImage->n);
    415424    psAssert(transIter >= 0, "Iterations for transparency must be non-negative: %d", transIter);
    416425    psAssert(transClip > 0, "Clipping level for transparency must be positive: %f", transClip);
     
    421430    stats->clipSigma = transClip;
    422431
    423     if (!psVectorStats(stats, trans, NULL, NULL, 0)) {
     432    if (!psVectorStats(stats, trans, NULL, badImage, 0xFF)) {
    424433        psError(PS_ERR_UNKNOWN, false, "Unable to perform statistics on transparencies.");
    425434        psFree(stats);
     
    432441    int numPhoto = 0;                   // Number of photometric images
    433442    for (int i = 0; i < numImages; i++) {
     443        if (badImage->data.U8[i]) {
     444            continue;
     445        }
    434446        if (trans->data.F32[i] < thresh) {
    435447            photo->data.U8[i] = 0xFF;
     
    451463                                      const psVector *zp, // Zero points for each image
    452464                                      const psVector *photo, // Photometric image?
     465                                      const psVector *badImage, // Bad image?
    453466                                      float starClip, // Clipping for stars
    454467                                      float sysErr2 // Systematic error squared
     
    468481    psAssert(!photo || photo->type.type == PS_TYPE_U8, "Photometric determination is wrong type");
    469482    psAssert(!photo || photo->n == numImages, "Not enough photometric determinations: %ld", photo->n);
     483    psAssert(!badImage || badImage->type.type == PS_TYPE_U8, "Photometric determination is wrong type");
     484    psAssert(!badImage || badImage->n == numImages, "Not enough bad determinations: %ld", badImage->n);
    470485
    471486    starClip = PS_SQR(starClip);
     
    481496            numMeasurements++;
    482497            int index = match->image->data.U32[j]; // Image index
     498            if (badImage->data.U8[index]) {
     499                continue;
     500            }
    483501            float mag = match->mag->data.F32[j]; // Measured magnitude
    484502            float magErr = match->magErr->data.F32[j]; // Error in measured magnitude
     
    489507            float dev = mag + cal - stars->data.F32[i]; // Deviation
    490508
    491             // only reject detections from photometric images (non-photometric images can
    492             // have large errors.  XXX Or: allow a much higher rejection threshold
    493             if (photo->data.U8[index]) {
    494               if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) {
    495                 numRejected++;
    496                 match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF;
    497               }
    498             }
     509            // only reject detections from photometric images (non-photometric images can
     510            // have large errors.  XXX Or: allow a much higher rejection threshold
     511            if (photo->data.U8[index]) {
     512                if (PS_SQR(dev) > starClip * (PS_SQR(magErr) + sysErr2)) {
     513                    numRejected++;
     514                    match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j] = 0xFF;
     515                }
     516            }
    499517        }
    500518    }
     
    529547    psVector *photo = psVectorAlloc(numImages, PS_TYPE_U8); // Photometric determination for each image
    530548    psVectorInit(photo, 0);
     549    psVector *badImage = psVectorAlloc(numImages, PS_TYPE_U8); // Bad image?
     550    psVectorInit(badImage, 0);
    531551    psVector *stars = psVectorAlloc(numStars, PS_TYPE_F32); // Magnitudes for each star
    532552
    533     float chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution
     553    float chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp,
     554                                           photo, sysErr); // chi^2 for solution
    534555    psTrace("psModules.objects", 1, "Initial: chi^2 = %f\n", chi2);
    535556    float lastChi2 = INFINITY;          // chi^2 on last iteration
     
    540561
    541562        // Identify photometric nights
    542         int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip, photoLevel); // Number of photometric images
    543         if (numPhoto < 0) {
    544             psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination");
    545             psFree(trans);
    546             psFree(photo);
    547             psFree(stars);
    548             return NULL;
    549         }
    550         psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages);
    551 
    552         // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe)
    553         fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, 20.0, PS_SQR(0.1));
    554         psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100);
    555 
    556         // XXX use 0.05 mag systematic error (move these to the recipe)
    557         chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, PS_SQR(0.1)); // chi^2 for solution
    558         psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
    559     }
    560 
    561     for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) {
    562         lastChi2 = chi2;
    563 
    564         // Identify photometric nights
    565         int numPhoto = sourceMatchRelphotPhotometric(photo, trans, transIter, transClip,
     563        int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip,
    566564                                                     photoLevel); // Number of photometric images
    567565        if (numPhoto < 0) {
     
    572570            return NULL;
    573571        }
     572        psTrace("psModules.objects", 3, "Pass 1: Determined %d/%d are photometric", numPhoto, numImages);
     573
     574        // XXX use 20 sigma rejection and 0.1 mag systematic error (move these to the recipe)
     575        fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, 20.0, PS_SQR(0.1));
     576        psTrace("psModules.objects", 3, "Pass 1: %f%% of measurements rejected", fracRej * 100);
     577
     578        // XXX use 0.05 mag systematic error (move these to the recipe)
     579        chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, PS_SQR(0.1));
     580        psTrace("psModules.objects", 1, "Pass 1: iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
     581    }
     582
     583    for (int i = 0; i < maxIter && (fabsf(lastChi2 - chi2) > tol * chi2 || fracRej > rejLimit); i++) {
     584        lastChi2 = chi2;
     585
     586        // Identify photometric nights
     587        int numPhoto = sourceMatchRelphotPhotometric(photo, trans, badImage, transIter, transClip,
     588                                                     photoLevel); // Number of photometric images
     589        if (numPhoto < 0) {
     590            psError(PS_ERR_UNKNOWN, false, "Unable to perform photometric determination");
     591            psFree(trans);
     592            psFree(photo);
     593            psFree(stars);
     594            return NULL;
     595        }
    574596        psTrace("psModules.objects", 3, "Determined %d/%d are photometric", numPhoto, numImages);
    575597
    576         fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, starClip, sysErr);
     598        fracRej = sourceMatchRelphotReject(trans, stars, matches, zp, photo, badImage, starClip, sysErr);
    577599        psTrace("psModules.objects", 3, "%f%% of measurements rejected", fracRej * 100);
    578600
    579         chi2 = sourceMatchRelphotIterate(trans, stars, matches, zp, photo, sysErr); // chi^2 for solution
     601        chi2 = sourceMatchRelphotIterate(trans, stars, badImage, matches, zp, photo, sysErr);
    580602        psTrace("psModules.objects", 1, "iter = %d: chi^2 = %f rejected = %f\n", i, chi2, fracRej);
    581603    }
    582604
    583605    psFree(photo);
     606    psFree(badImage);
    584607    psFree(stars);
    585608
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceSky.c

    r21363 r23199  
    5555    psImageMaskType markVal)
    5656{
    57     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     57    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    5858    PS_ASSERT_PTR_NON_NULL(source, false);
    5959    PS_ASSERT_IMAGE_NON_NULL(source->pixels, false);
     
    9191
    9292    if (isnan(value)) {
    93         psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);
     93        psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__);
    9494        return(false);
    9595    }
     
    9898    }
    9999    source->moments->Sky = value;
    100     psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);
     100    psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__);
    101101    return (true);
    102102}
     
    111111)
    112112{
    113     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     113    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    114114    PS_ASSERT_PTR_NON_NULL(source, false);
    115115    PS_ASSERT_IMAGE_NON_NULL(source->variance, false);
     
    147147
    148148    if (isnan(value)) {
    149         psTrace("psModules.objects", 3, "---- %s(false) end ----\n", __func__);
     149        psTrace("psModules.objects", 10, "---- %s(false) end ----\n", __func__);
    150150        return(false);
    151151    }
     
    154154    }
    155155    source->moments->dSky = value;
    156     psTrace("psModules.objects", 3, "---- %s(true) end ----\n", __func__);
     156    psTrace("psModules.objects", 10, "---- %s(true) end ----\n", __func__);
    157157    return (true);
    158158}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceUtils.c

    r20937 r23199  
    4949                            pmModelType modelType)
    5050{
    51     psTrace("psModules.objects", 3, "---- %s() begin ----\n", __func__);
     51    psTrace("psModules.objects", 10, "---- %s() begin ----\n", __func__);
    5252    PS_ASSERT_PTR_NON_NULL(source, NULL);
    5353    PS_ASSERT_PTR_NON_NULL(source->moments, NULL);
     
    6161    }
    6262
    63     psTrace("psModules.objects", 3, "---- %s() end ----\n", __func__);
     63    psTrace("psModules.objects", 10, "---- %s() end ----\n", __func__);
    6464    return(model);
    6565}
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/objects/pmSourceVisual.c

    r22722 r23199  
    77#include "pmSourceVisual.h"
    88
    9 # if (HAVE_KAPA)
    10 # include <kapa.h>
     9#if (HAVE_KAPA)
     10#include <kapa.h>
    1111#include "pmVisual.h"
    1212
     
    155155    // continue, save (provide name), ??
    156156    pmVisualAskUser(&plotPSF);
     157
    157158    return true;
    158159}
     
    251252}
    252253
    253 # else
    254 # endif
     254#else
     255
     256bool pmSourceSetVisual(bool mode)
     257{
     258    return true;
     259}
     260
     261bool pmSourceVisualPSFModelResid(pmTrend2D *trend, psVector *x, psVector *y, psVector *param, psVector *mask)
     262{
     263    return true;
     264}
     265
     266#endif
  • branches/cnb_branches/cnb_branch_20090215/psModules/src/psmodules.h

    r23197 r23199  
    114114#include <pmPSF.h>
    115115#include <pmModel.h>
     116#include <pmSourceMasks.h>
    116117#include <pmSource.h>
    117118#include <pmSourceUtils.h>
Note: See TracChangeset for help on using the changeset viewer.