IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 21454


Ignore:
Timestamp:
Feb 11, 2009, 6:45:13 PM (17 years ago)
Author:
eugene
Message:

trying to define a way of loading source locations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20090208/psphot/src/psphotMergeSources.c

    r21251 r21454  
    122122    return detections;
    123123}
     124
     125// generate the detection structure for the supplied array of sources
     126bool psphotSetSourceParams (pmConfig *config, psArray *sources, pmPSF *psf) {
     127
     128    psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE);
     129    if (!recipe) {
     130        psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSPHOT_RECIPE);
     131        return false;
     132    }
     133
     134    for (int i = 0; i < sources->n; i++) {
     135        pmSource *source = sources->data[i];
     136        pmModel *model = source->modelPSF;
     137
     138        if (source->mode & PSF_SOURCE_MASK || !isfinite(source->psfMag)) {
     139            continue;
     140        }
     141
     142        float flux = powf(10.0, -0.4 * source->psfMag);
     143        float xpos = model->params->data.F32[PM_PAR_XPOS];
     144        float ypos = model->params->data.F32[PM_PAR_YPOS];
     145
     146        pmPeak *peak = pmPeakAlloc(xpos, ypos, 1.0, PM_PEAK_LONE);
     147        peak->xf = xpos;
     148        peak->yf = ypos;
     149        peak->flux = flux; // this are being set wrong, but does it matter?
     150
     151        if (isfinite (source->errMag) && (source->errMag > 0.0)) {
     152          peak->SN = 1.0 / source->errMag;
     153        } else {
     154          peak->SN = 0.0;
     155        }
     156
     157        source->peak = peak;
     158    }
     159
     160    psLogMsg ("psphot", 3, "%ld PSF sources loaded", sources->n);
     161
     162    return true;
     163}
Note: See TracChangeset for help on using the changeset viewer.