IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 16, 2006, 4:24:03 PM (20 years ago)
Author:
Paul Price
Message:

NOT_U8 and NOT_U16 macros were moved into psLib (and renamed with PS_ prefix). Updating files that use these macros so that they compile.

File:
1 edited

Legend:

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

    r9270 r9595  
    33// select objects fitted with PSF model
    44// re-fit all of them with the non-poisson errors
    5 // only allow the normalization to vary 
     5// only allow the normalization to vary
    66// XXX eventually, we should be able to do this with linear fitting...
    7 bool psphotWeightBias (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf) { 
     7bool psphotWeightBias (pmReadout *readout, psArray *sources, psMetadata *recipe, pmPSF *psf) {
    88
    99    int Nfit = 0;
     
    1616    // source analysis is done in S/N order (brightest first)
    1717    sources = psArraySort (sources, psphotSortBySN);
    18    
     18
    1919    // set fitting method to use non-poisson errors (local sky error)
    2020    pmSourceFitModelInit (15, 0.1, false);
    21    
     21
    2222    // option to limit analysis to a specific region
    2323    char *region = psMetadataLookupStr (&status, recipe, "ANALYSIS_REGION");
     
    2929
    3030    for (int i = 0; i < sources->n; i++) {
    31         pmSource *source = sources->data[i];
     31        pmSource *source = sources->data[i];
    3232
    33         // skip lower-quality objects
    34         if (source->type != PM_SOURCE_TYPE_STAR) continue;
    35         if (source->mode &  PM_SOURCE_MODE_POOR) continue;
    36         if (source->mode &  PM_SOURCE_MODE_FAIL) continue;
    37         if (source->mode &  PM_SOURCE_MODE_PAIR) continue;
    38         if (source->mode &  PM_SOURCE_MODE_BLEND) continue;
    39         if (source->mode &  PM_SOURCE_MODE_SATSTAR) continue;
     33        // skip lower-quality objects
     34        if (source->type != PM_SOURCE_TYPE_STAR) continue;
     35        if (source->mode &  PM_SOURCE_MODE_POOR) continue;
     36        if (source->mode &  PM_SOURCE_MODE_FAIL) continue;
     37        if (source->mode &  PM_SOURCE_MODE_PAIR) continue;
     38        if (source->mode &  PM_SOURCE_MODE_BLEND) continue;
     39        if (source->mode &  PM_SOURCE_MODE_SATSTAR) continue;
    4040
    41         // if model is NULL, we don't have a starting guess
    42         if (source->modelPSF == NULL) continue;
     41        // if model is NULL, we don't have a starting guess
     42        if (source->modelPSF == NULL) continue;
    4343
    44         if (source->moments->x < AnalysisRegion.x0) continue;
    45         if (source->moments->y < AnalysisRegion.y0) continue;
    46         if (source->moments->x > AnalysisRegion.x1) continue;
    47         if (source->moments->y > AnalysisRegion.y1) continue;
     44        if (source->moments->x < AnalysisRegion.x0) continue;
     45        if (source->moments->y < AnalysisRegion.y0) continue;
     46        if (source->moments->x > AnalysisRegion.x1) continue;
     47        if (source->moments->y > AnalysisRegion.y1) continue;
    4848
    49         // replace object in image
    50         pmModelAdd (source->pixels, source->mask, source->modelPSF, false, false);
     49        // replace object in image
     50        pmModelAdd (source->pixels, source->mask, source->modelPSF, false, false);
    5151
    52         // make a temporary model (we don't keep the result of this analysis)
    53         pmModel *PSF = pmModelCopy (source->modelPSF);
     52        // make a temporary model (we don't keep the result of this analysis)
     53        pmModel *PSF = pmModelCopy (source->modelPSF);
    5454
    55         // extend source radius as needed
    56         psphotCheckRadiusPSF (readout, source, PSF);
     55        // extend source radius as needed
     56        psphotCheckRadiusPSF (readout, source, PSF);
    5757
    58         x = PSF->params->data.F32[2];
    59         y = PSF->params->data.F32[3];
     58        x = PSF->params->data.F32[2];
     59        y = PSF->params->data.F32[3];
    6060
    61         // fit PSF model (set/unset the pixel mask)
    62         psImageKeepCircle (source->mask, x, y, PSF->radiusTMP, "OR", PM_MASK_MARK);
    63         pmSourceFitModel (source, PSF, PM_SOURCE_FIT_NORM);
    64         psImageKeepCircle (source->mask, x, y, PSF->radiusTMP, "AND", NOT_U8(PM_MASK_MARK));
    65    
    66         // re-subtract PSF for object, leave local sky
    67         pmModelSub (source->pixels, source->mask, source->modelPSF, false, false);
     61        // fit PSF model (set/unset the pixel mask)
     62        psImageKeepCircle (source->mask, x, y, PSF->radiusTMP, "OR", PM_MASK_MARK);
     63        pmSourceFitModel (source, PSF, PM_SOURCE_FIT_NORM);
     64        psImageKeepCircle (source->mask, x, y, PSF->radiusTMP, "AND", PS_NOT_U8(PM_MASK_MARK));
    6865
    69         PARp = source->modelPSF->params->data.F32;
    70         PARc = PSF->params->data.F32;
    71         fprintf (f, "%7.1f %7.1f %9.2f %9.2f %10.3f\n", PARp[2], PARp[3], PARp[1], PARc[1], source->moments->dSky);
    72         Nfit ++;
     66        // re-subtract PSF for object, leave local sky
     67        pmModelSub (source->pixels, source->mask, source->modelPSF, false, false);
     68
     69        PARp = source->modelPSF->params->data.F32;
     70        PARc = PSF->params->data.F32;
     71        fprintf (f, "%7.1f %7.1f %9.2f %9.2f %10.3f\n", PARp[2], PARp[3], PARp[1], PARc[1], source->moments->dSky);
     72        Nfit ++;
    7373    }
    7474    fclose (f);
Note: See TracChangeset for help on using the changeset viewer.