IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10138


Ignore:
Timestamp:
Nov 22, 2006, 4:27:40 AM (20 years ago)
Author:
rhl
Message:

Allowed psphotMagnitudes() access to background sky map

Location:
trunk/psphot/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotMagnitudes.c

    r9994 r10138  
    11# include "psphot.h"
    22
    3 bool psphotMagnitudes (psArray *sources, psMetadata *recipe, pmPSF *psf) {
    4 
     3bool psphotMagnitudes(psArray *sources,
     4                      psMetadata *recipe,
     5                      pmPSF *psf,
     6                      const pmConfig *config)
     7{
    58    bool status = false;
    69    int Nap = 0;
     
    912
    1013    pmSourceMagnitudesInit (recipe);
     14
     15    // Get enough information to return sky level
     16    assert (config != NULL);
     17    const psImage *background = NULL;
     18    int DX = 0, DY = 0, dx = 0, dy = 0; // unpacked with PSPHOT.BACKMDL
     19    {
     20        const pmFPAfile *backgroundFile = psMetadataLookupPtr(&status, config->files, "PSPHOT.BACKMDL");
     21        if (backgroundFile != NULL) {
     22            assert (backgroundFile->readout != NULL);
     23            background = backgroundFile->readout->image;
     24
     25            assert(backgroundFile->readout->analysis != NULL);
     26            DX = psMetadataLookupS32(&status, backgroundFile->readout->analysis, "XBIN");
     27            assert (status == true);
     28            DY = psMetadataLookupS32(&status, backgroundFile->readout->analysis, "YBIN");
     29            assert (status == true);
     30            dx = psMetadataLookupS32(&status, backgroundFile->readout->analysis, "x0");
     31            assert (status == true);
     32            dy = psMetadataLookupS32(&status, backgroundFile->readout->analysis, "y0");
     33            assert (status == true);
     34        }
     35    }
    1136
    1237    bool IGNORE_GROWTH = psMetadataLookupBool (&status, recipe, "IGNORE_GROWTH");
     
    2146        status = pmSourceMagnitudes (source, psf, photMode);
    2247        if (status) Nap ++;
     48
     49        source->sky = 0;
     50#if 0
     51        source->sky += source->moments->Sky;
     52#endif
     53
     54        if (background != NULL) {
     55            source->sky += psImageUnbinPixel(source->peak->x, source->peak->y, background, DX, DY, dx, dy);
     56            if (isnan(source->sky) && false) {
     57                psError(PSPHOT_ERR_SKY, false, "Setting pmSource.sky");
     58                psErrorStackPrint(NULL, " ");
     59                psErrorClear();
     60            }
     61        }
    2362    }   
    2463
  • trunk/psphot/src/psphotReadout.c

    r10052 r10138  
    111111
    112112    // calculate source magnitudes
    113     psphotMagnitudes (sources, recipe, psf);
     113    psphotMagnitudes(sources, recipe, psf, config);
    114114
    115115    // replace background in residual image
Note: See TracChangeset for help on using the changeset viewer.