IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26645


Ignore:
Timestamp:
Jan 20, 2010, 2:41:50 PM (16 years ago)
Author:
Paul Price
Message:

Need to unassign peaks so that moments will be measured in psphotReadoutFindPSF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/psphot/src/psphotMergeSources.c

    r26317 r26645  
    1313
    1414    // load data from input CMF file:
    15     { 
    16         pmReadout *readoutCMF = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF");
    17         if (!readoutCMF) goto loadTXT;
     15    {
     16        pmReadout *readoutCMF = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF");
     17        if (!readoutCMF) goto loadTXT;
    1818
    19         extSourcesCMF = psMetadataLookupPtr (NULL, readoutCMF->analysis, "PSPHOT.SOURCES");
    20         if (extSourcesCMF) {
    21             for (int i = 0; i < extSourcesCMF->n; i++) {
    22                 pmSource *source = extSourcesCMF->data[i];
    23                 source->mode |= PM_SOURCE_MODE_EXTERNAL;
     19        extSourcesCMF = psMetadataLookupPtr (NULL, readoutCMF->analysis, "PSPHOT.SOURCES");
     20        if (extSourcesCMF) {
     21            for (int i = 0; i < extSourcesCMF->n; i++) {
     22                pmSource *source = extSourcesCMF->data[i];
     23                source->mode |= PM_SOURCE_MODE_EXTERNAL;
    2424
    25                 // the supplied peak flux needs to be re-normalized
    26                 source->peak->flux = 1.0;
    27                 source->peak->value = 1.0;
     25                // the supplied peak flux needs to be re-normalized
     26                source->peak->flux = 1.0;
     27                source->peak->value = 1.0;
    2828
    29                 // drop the loaded source modelPSF
    30                 psFree (source->modelPSF);
    31                 source->modelPSF = NULL;
    32             }
    33             psphotMergeSources (sources, extSourcesCMF);
    34         }
     29                // drop the loaded source modelPSF
     30                psFree (source->modelPSF);
     31                source->modelPSF = NULL;
     32            }
     33            psphotMergeSources (sources, extSourcesCMF);
     34        }
    3535    }
    3636
     
    3838
    3939    // load data from input TXT file:
    40     { 
    41         pmChip *chipTXT = pmFPAfileThisChip (config->files, view, "PSPHOT.INPUT");
    42         if (!chipTXT) goto finish;
     40    {
     41        pmChip *chipTXT = pmFPAfileThisChip (config->files, view, "PSPHOT.INPUT");
     42        if (!chipTXT) goto finish;
    4343
    44         extSourcesTXT = psMetadataLookupPtr (NULL, chipTXT->analysis, "PSPHOT.SOURCES.TEXT");
    45         if (extSourcesTXT) {
    46             for (int i = 0; i < extSourcesTXT->n; i++) {
    47                 pmSource *source = extSourcesTXT->data[i];
    48                 source->mode |= PM_SOURCE_MODE_EXTERNAL;
     44        extSourcesTXT = psMetadataLookupPtr (NULL, chipTXT->analysis, "PSPHOT.SOURCES.TEXT");
     45        if (extSourcesTXT) {
     46            for (int i = 0; i < extSourcesTXT->n; i++) {
     47                pmSource *source = extSourcesTXT->data[i];
     48                source->mode |= PM_SOURCE_MODE_EXTERNAL;
    4949
    50                 // drop the loaded source modelPSF
    51                 psFree (source->modelPSF);
    52                 source->modelPSF = NULL;
    53             }
    54             psphotMergeSources (sources, extSourcesTXT);
    55         }
     50                // drop the loaded source modelPSF
     51                psFree (source->modelPSF);
     52                source->modelPSF = NULL;
     53            }
     54            psphotMergeSources (sources, extSourcesTXT);
     55        }
    5656    }
    5757
     
    6666    int nTXT = extSourcesTXT ? extSourcesTXT->n : 0;
    6767
    68     psLogMsg ("psphot", 3, "%d external sources (%d cmf, %d text) merged to yield %ld total sources", 
    69               nCMF + nTXT, nCMF, nTXT, sources->n);
     68    psLogMsg ("psphot", 3, "%d external sources (%d cmf, %d text) merged to yield %ld total sources",
     69              nCMF + nTXT, nCMF, nTXT, sources->n);
    7070    return true;
    7171}
     
    124124        }
    125125
    126         // use the existing peak information, otherwise generate a new peak
    127         if (source->peak) {
    128             psArrayAdd (detections->peaks, 100, source->peak);
    129             continue;
    130         }
     126        // use the existing peak information, otherwise generate a new peak
     127        if (source->peak) {
     128            source->peak->assigned = false; // So the moments will be measured
     129            psArrayAdd (detections->peaks, 100, source->peak);
     130            continue;
     131        }
    131132
    132133        float flux = powf(10.0, -0.4 * source->psfMag);
     
    139140        peak->flux = flux; // this are being set wrong, but does it matter?
    140141
    141         if (isfinite (source->errMag) && (source->errMag > 0.0)) {
    142           peak->SN = 1.0 / source->errMag;
    143         } else {
    144           peak->SN = 0.0;
    145         }
     142        if (isfinite (source->errMag) && (source->errMag > 0.0)) {
     143          peak->SN = 1.0 / source->errMag;
     144        } else {
     145          peak->SN = 0.0;
     146        }
    146147
    147148        psArrayAdd (detections->peaks, 100, peak);
     
    180181        peak->flux = flux; // this are being set wrong, but does it matter?
    181182
    182         if (isfinite (source->errMag) && (source->errMag > 0.0)) {
    183           peak->SN = 1.0 / source->errMag;
    184         } else {
    185           peak->SN = 0.0;
    186         }
     183        if (isfinite (source->errMag) && (source->errMag > 0.0)) {
     184          peak->SN = 1.0 / source->errMag;
     185        } else {
     186          peak->SN = 0.0;
     187        }
    187188
    188189        source->peak = peak;
Note: See TracChangeset for help on using the changeset viewer.