IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 28, 2009, 10:49:50 AM (17 years ago)
Author:
Paul Price
Message:

Merging pap_branch_20090108: fixed photometric normalisation. Conflicts resolved, code compiles.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStackSources.c

    r21183 r21199  
    99//#define TESTING                         // Enable debugging output
    1010
     11// Size of fake image; set by hand because it's trouble to get it from other places
     12#define FAKE_COLS 4861
     13#define FAKE_ROWS 4913
    1114
    1215float ppStackSourcesTransparency(const psArray *sourceLists, const pmFPAview *view, const pmConfig *config)
     
    6063        pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
    6164
     65#ifdef TESTING
     66        pmReadout *fake = pmReadoutAlloc(NULL); // Fake readout
     67        pmPSF *psf = psMetadataLookupPtr(NULL, config->arguments, "PSF.TARGET"); // PSF for fake image
     68        pmReadoutFakeFromSources(fake, FAKE_COLS, FAKE_ROWS, sourceLists->data[i], NULL, NULL, psf, 5, 0, false, true);
     69        psString name = NULL;
     70        psStringAppend(&name, "start_%03d.fits", i);
     71        psFits *fits = psFitsOpen(name, "w");
     72        psFree(name);
     73        psFitsWriteImage(fits, NULL, fake->image, 0, NULL);
     74        psFitsClose(fits);
     75        psFree(fake);
     76#endif
     77
     78
    6279        float exptime = psMetadataLookupF32(NULL, cell->concepts, "CELL.EXPOSURE"); // Exposure time
    6380        float airmass = psMetadataLookupF32(NULL, file->fpa->concepts, "FPA.AIRMASS"); // Airmass
     
    105122        FILE *outMatches = fopen("source_match.dat", "w"); // Output matches
    106123        psVector *mag = psVectorAlloc(num, PS_TYPE_F32); // Magnitudes for each star
     124        psVector *magErr = psVectorAlloc(num, PS_TYPE_F32); // Errors for each star
    107125        for (int i = 0; i < matches->n; i++) {
    108126            pmSourceMatch *match = matches->data[i]; // Match of interest
    109127            psVectorInit(mag, NAN);
     128            psVectorInit(magErr, NAN);
    110129            for (int j = 0; j < match->num; j++) {
    111130                if (match->mask->data.PS_TYPE_VECTOR_MASK_DATA[j]) {
     
    114133                int index = match->image->data.U32[j]; // Image index
    115134                mag->data.F32[index] = match->mag->data.F32[j] - zp->data.F32[index] - trans->data.F32[index];
     135                magErr->data.F32[index] = match->magErr->data.F32[j];
    116136            }
    117137            for (int j = 0; j < num; j++) {
    118                 fprintf(outMatches, "%f ", mag->data.F32[j]);
     138                fprintf(outMatches, "%f (%f) ", mag->data.F32[j], magErr->data.F32[j]);
    119139            }
    120140            fprintf(outMatches, "\n");
    121141        }
    122142        psFree(mag);
     143        psFree(magErr);
    123144        fclose(outMatches);
    124145    }
     
    162183        psVector *trans = pmSourceMatchRelphot(matches, zp, iter, tol, starLimit, transIter, transRej,
    163184                                               transThresh, starRej, starSys);
     185        for (int i = 0; i < num; i++) {
     186            fprintf(stderr, "Transparency of image %d: %f\n", i, trans->data.F32[i]);
     187        }
    164188        psFree(trans);
    165189    }
Note: See TracChangeset for help on using the changeset viewer.