IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20070


Ignore:
Timestamp:
Oct 11, 2008, 11:55:22 AM (18 years ago)
Author:
eugene
Message:

adding psphotReadoutFindPSF

Location:
trunk/psphot/src
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/Makefile.am

    r19907 r20070  
    2727        psphotDefineFiles.c            \
    2828        psphotReadout.c                \
     29        psphotReadoutFindPSF.c         \
    2930        psphotModelBackground.c        \
    3031        psphotSubtractBackground.c     \
  • trunk/psphot/src/psphot.h

    r19917 r20070  
    2121bool            psphotModelTest (pmConfig *config, const pmFPAview *view, psMetadata *recipe);
    2222bool            psphotReadout (pmConfig *config, const pmFPAview *view);
     23bool            psphotReadoutFindPSF(pmConfig *config, const pmFPAview *view);
    2324bool            psphotReadoutCleanup (pmConfig *config, pmReadout *readout, psMetadata *recipe, pmDetections *detections, pmPSF *psf, psArray *sources);
    2425bool            psphotDefineFiles (pmConfig *config, pmFPAfile *input);
     
    107108bool            psphotMergeSources (psArray *oldSources, psArray *newSources);
    108109bool            psphotLoadExtSources (pmConfig *config, const pmFPAview *view, psArray *sources);
     110
     111pmDetections   *psphotLoadPSFSources (pmConfig *config, const pmFPAview *view);
     112
    109113pmPSF          *psphotLoadPSF (pmConfig *config, const pmFPAview *view, psMetadata *recipe);
    110114bool            psphotSetHeaderNstars (psMetadata *recipe, psArray *sources);
  • trunk/psphot/src/psphotMergeSources.c

    r13411 r20070  
    5151    return true;
    5252}
     53
     54pmDetections *detections = psphotLoadPSFSources (pmConfig *config, const pmFPAview *view) {
     55
     56    // find the currently selected readout
     57    pmReadout  *readout = pmFPAfileThisReadout (config->files, view, "PSPHOT.INPUT.CMF");
     58    if (!readout) {
     59        psLogMsg ("psphot", 3, "readout not found");
     60        return NULL;
     61    }
     62
     63    pmDetections *detections = pmDetectionsAlloc();
     64 
     65    psArray *sources = psMetadataLookupPtr (NULL, readout->analysis, "PSPHOT.SOURCES");
     66    if (!sources) {
     67        psLogMsg ("psphot", 3, "no psf sources for this readout");
     68        return detections;
     69    }
     70
     71    detections->peaks = psArrayAllocEmpty(100);
     72
     73    for (int i = 0; i < sources->n; i++) {
     74        pmSource *source = sources->data[i];
     75        pmModel *model = source->modelPSF;
     76
     77        float xpos = model->params->data.F32[PM_PAR_XPOS];
     78        float ypos = model->params->data.F32[PM_PAR_YPOS];
     79
     80        pmPeak *peak = pmPeakAlloc(xpos, ypos, 1.0, PM_PEAK_LONE);
     81        peak->xf = xpos;
     82        peak->yf = ypos;
     83        peak->flux = 1.0;
     84
     85        psArrayAdd (detections->peaks, 100, peak);
     86        psFree (peak);
     87    }
     88
     89    psLogMsg ("psphot", 3, "%ld PSF sources loaded", detections->peaks->nn);
     90
     91    return detections;
     92}
Note: See TracChangeset for help on using the changeset viewer.